From: Michal Hocko <mhocko@kernel.org>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: "Jérôme Glisse" <jglisse@redhat.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-mm@kvack.org, "David (ChunMing) Zhou" <David1.Zhou@amd.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"David Airlie" <airlied@linux.ie>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Doug Ledford" <dledford@redhat.com>,
"Jason Gunthorpe" <jgg@ziepe.ca>,
"Mike Marciniszyn" <mike.marciniszyn@intel.com>,
"Dennis Dalessandro" <dennis.dalessandro@intel.com>,
"Sudeep Dutt" <sudeep.dutt@intel.com>,
"Ashutosh Dixit" <ashutosh.dixit@intel.com>,
"Dimitri Sivanich" <sivanich@sgi.com>,
"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
"Juergen Gross" <jgross@suse.com>,
"Andrea Arcangeli" <aarcange@redhat.com>,
"Felix Kuehling" <felix.kuehling@amd.com>,
kvm@vger.kernel.org, amd-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
linux-rdma@vger.kernel.org, xen-devel@lists.xenproject.org,
"Christian König" <christian.koenig@amd.com>,
"David Rientjes" <rientjes@google.com>,
"Leon Romanovsky" <leonro@mellanox.com>
Subject: Re: [PATCH] mm, oom: distinguish blockable mode for mmu notifiers
Date: Fri, 24 Aug 2018 15:32:07 +0200 [thread overview]
Message-ID: <20180824133207.GR29735@dhcp22.suse.cz> (raw)
In-Reply-To: <103b1b33-1a1d-27a1-dcf8-5c8ad60056a6@i-love.sakura.ne.jp>
On Fri 24-08-18 22:02:23, Tetsuo Handa wrote:
> On 2018/08/24 20:36, Michal Hocko wrote:
> >> That is, this API seems to be currently used by only out-of-tree users. Since
> >> we can't check that nobody has memory allocation dependency, I think that
> >> hmm_invalidate_range_start() should return -EAGAIN if blockable == false for now.
> >
> > The code expects that the invalidate_range_end doesn't block if
> > invalidate_range_start hasn't blocked. That is the reason why the end
> > callback doesn't have blockable parameter. If this doesn't hold then the
> > whole scheme is just fragile because those two calls should pair.
> >
> That is
>
> More worrisome part in that patch is that I don't know whether using
> trylock if blockable == false at entry is really sufficient.
>
> . Since those two calls should pair, I think that we need to determine whether
> we need to return -EAGAIN at start call by evaluating both calls.
Yes, and I believe I have done that audit. Module my misunderstanding of
the code.
> Like mn_invl_range_start() involves schedule_delayed_work() which could be
> blocked on memory allocation under OOM situation,
It doesn't because that code path is not invoked for the !blockable
case.
> I worry that (currently
> out-of-tree) users of this API are involving work / recursion.
I do not give a slightest about out-of-tree modules. They will have to
accomodate to the new API. I have no problems to extend the
documentation and be explicit about this expectation.
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 133ba78820ee..698e371aafe3 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -153,7 +153,9 @@ struct mmu_notifier_ops {
*
* If blockable argument is set to false then the callback cannot
* sleep and has to return with -EAGAIN. 0 should be returned
- * otherwise.
+ * otherwise. Please note that if invalidate_range_start approves
+ * a non-blocking behavior then the same applies to
+ * invalidate_range_end.
*
*/
int (*invalidate_range_start)(struct mmu_notifier *mn,
> And hmm_release() says that
>
> /*
> * Drop mirrors_sem so callback can wait on any pending
> * work that might itself trigger mmu_notifier callback
> * and thus would deadlock with us.
> */
>
> and keeps "all operations protected by hmm->mirrors_sem held for write are
> atomic". This suggests that "some operations protected by hmm->mirrors_sem held
> for read will sleep (and in the worst case involves memory allocation
> dependency)".
Yes and so what? The clear expectation is that neither of the range
notifiers do not sleep in !blocking mode. I really fail to see what you
are trying to say.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2018-08-24 13:32 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-16 11:50 [PATCH] mm, oom: distinguish blockable mode for mmu notifiers Michal Hocko
2018-07-16 23:12 ` Andrew Morton
2018-07-17 4:03 ` Leon Romanovsky
2018-07-17 8:12 ` Michal Hocko
2018-07-20 23:01 ` Andrew Morton
2018-07-23 8:43 ` Michal Hocko
2018-07-19 9:12 ` Michal Hocko
2018-07-21 0:09 ` Andrew Morton
2018-07-23 7:03 ` Michal Hocko
2018-07-23 7:11 ` Michal Hocko
2018-07-23 8:11 ` Michal Hocko
2018-07-24 14:17 ` Michal Hocko
2018-07-24 19:53 ` Andrew Morton
2018-07-25 6:17 ` Michal Hocko
2018-07-24 21:07 ` David Rientjes
2018-07-25 6:13 ` Michal Hocko
2018-08-24 10:54 ` Tetsuo Handa
2018-08-24 11:32 ` Michal Hocko
2018-08-24 11:43 ` Christian König
2018-08-24 11:52 ` Michal Hocko
2018-08-24 11:57 ` Christian König
2018-08-24 12:03 ` Michal Hocko
2018-08-24 12:18 ` Christian König
2018-08-24 12:33 ` Michal Hocko
2018-08-24 12:52 ` Christian König
2018-08-24 13:01 ` Michal Hocko
2018-08-24 13:10 ` Christian König
2018-08-24 13:24 ` Michal Hocko
2018-08-24 13:28 ` Christian König
2018-08-24 13:40 ` Michal Hocko
2018-08-24 13:44 ` Christian König
2018-08-24 13:52 ` Michal Hocko
2018-08-26 8:40 ` Tetsuo Handa
2018-08-27 7:41 ` Christian König
2018-09-06 22:46 ` Tetsuo Handa
2018-08-24 15:08 ` Jerome Glisse
2018-08-24 11:36 ` Michal Hocko
2018-08-24 13:02 ` Tetsuo Handa
2018-08-24 13:32 ` Michal Hocko [this message]
2018-08-24 14:52 ` Tetsuo Handa
2018-08-24 15:12 ` Jerome Glisse
2018-08-24 16:40 ` Michal Hocko
2018-08-24 17:33 ` Jerome Glisse
2018-08-24 16:38 ` Michal Hocko
2018-08-24 14:40 ` Jerome Glisse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180824133207.GR29735@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=David1.Zhou@amd.com \
--cc=aarcange@redhat.com \
--cc=airlied@linux.ie \
--cc=akpm@linux-foundation.org \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=ashutosh.dixit@intel.com \
--cc=boris.ostrovsky@oracle.com \
--cc=christian.koenig@amd.com \
--cc=dennis.dalessandro@intel.com \
--cc=dledford@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=felix.kuehling@amd.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jgg@ziepe.ca \
--cc=jglisse@redhat.com \
--cc=jgross@suse.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=leonro@mellanox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mike.marciniszyn@intel.com \
--cc=pbonzini@redhat.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=rientjes@google.com \
--cc=rkrcmar@redhat.com \
--cc=rodrigo.vivi@intel.com \
--cc=sivanich@sgi.com \
--cc=sudeep.dutt@intel.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).