All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leonro@mellanox.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Michal Hocko" <mhocko@suse.com>,
	kvm@vger.kernel.org, "Radim Krčmář" <rkrcmar@redhat.com>,
	"David Airlie" <airlied@linux.ie>,
	"Sudeep Dutt" <sudeep.dutt@intel.com>,
	dri-devel@lists.freedesktop.org,
	"Michal Hocko" <mhocko@kernel.org>,
	linux-mm@kvack.org, "Andrea Arcangeli" <aarcange@redhat.com>,
	"David (ChunMing) Zhou" <David1.Zhou@amd.com>,
	"Dimitri Sivanich" <sivanich@sgi.com>,
	linux-rdma@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Doug Ledford" <dledford@redhat.com>,
	"David Rientjes" <rientjes@google.com>,
	xen-devel@lists.xenproject.org, intel-gfx@lists.freedesktop.org,
	"Jérôme Glisse" <jglisse@redhat.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
	"Juergen Gross" <jgross@suse.com>,
	"Mike Marciniszyn" <mike.marciniszyn@intel.com>,
	"Dennis Dalessandro" <dennis.dalessandro@inte>
Subject: Re: [PATCH] mm, oom: distinguish blockable mode for mmu notifiers
Date: Tue, 17 Jul 2018 07:03:47 +0300	[thread overview]
Message-ID: <20180717040347.GT3152@mtr-leonro.mtl.com> (raw)
In-Reply-To: <20180716161249.c76240cd487c070fb271d529@linux-foundation.org>


[-- Attachment #1.1: Type: text/plain, Size: 2130 bytes --]

On Mon, Jul 16, 2018 at 04:12:49PM -0700, Andrew Morton wrote:
> On Mon, 16 Jul 2018 13:50:58 +0200 Michal Hocko <mhocko@kernel.org> wrote:
>
> > From: Michal Hocko <mhocko@suse.com>
> >
> > There are several blockable mmu notifiers which might sleep in
> > mmu_notifier_invalidate_range_start and that is a problem for the
> > oom_reaper because it needs to guarantee a forward progress so it cannot
> > depend on any sleepable locks.
> >
> > Currently we simply back off and mark an oom victim with blockable mmu
> > notifiers as done after a short sleep. That can result in selecting a
> > new oom victim prematurely because the previous one still hasn't torn
> > its memory down yet.
> >
> > We can do much better though. Even if mmu notifiers use sleepable locks
> > there is no reason to automatically assume those locks are held.
> > Moreover majority of notifiers only care about a portion of the address
> > space and there is absolutely zero reason to fail when we are unmapping an
> > unrelated range. Many notifiers do really block and wait for HW which is
> > harder to handle and we have to bail out though.
> >
> > This patch handles the low hanging fruid. __mmu_notifier_invalidate_range_start
> > gets a blockable flag and callbacks are not allowed to sleep if the
> > flag is set to false. This is achieved by using trylock instead of the
> > sleepable lock for most callbacks and continue as long as we do not
> > block down the call chain.
>
> I assume device driver developers are wondering "what does this mean
> for me".  As I understand it, the only time they will see
> blockable==false is when their driver is being called in response to an
> out-of-memory condition, yes?  So it is a very rare thing.

I can't say for everyone, but at least for me (mlx5), it is not rare event.
I'm seeing OOM very often while I'm running my tests in low memory VMs.

Thanks

>
> Any suggestions regarding how the driver developers can test this code
> path?  I don't think we presently have a way to fake an oom-killing
> event?  Perhaps we should add such a thing, given the problems we're
> having with that feature.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Leon Romanovsky <leonro@mellanox.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Michal Hocko" <mhocko@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org, "Michal Hocko" <mhocko@suse.com>,
	"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>,
	"Jérôme Glisse" <jglisse@redhat.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>
Subject: Re: [PATCH] mm, oom: distinguish blockable mode for mmu notifiers
Date: Tue, 17 Jul 2018 07:03:47 +0300	[thread overview]
Message-ID: <20180717040347.GT3152@mtr-leonro.mtl.com> (raw)
In-Reply-To: <20180716161249.c76240cd487c070fb271d529@linux-foundation.org>

[-- Attachment #1: Type: text/plain, Size: 2130 bytes --]

On Mon, Jul 16, 2018 at 04:12:49PM -0700, Andrew Morton wrote:
> On Mon, 16 Jul 2018 13:50:58 +0200 Michal Hocko <mhocko@kernel.org> wrote:
>
> > From: Michal Hocko <mhocko@suse.com>
> >
> > There are several blockable mmu notifiers which might sleep in
> > mmu_notifier_invalidate_range_start and that is a problem for the
> > oom_reaper because it needs to guarantee a forward progress so it cannot
> > depend on any sleepable locks.
> >
> > Currently we simply back off and mark an oom victim with blockable mmu
> > notifiers as done after a short sleep. That can result in selecting a
> > new oom victim prematurely because the previous one still hasn't torn
> > its memory down yet.
> >
> > We can do much better though. Even if mmu notifiers use sleepable locks
> > there is no reason to automatically assume those locks are held.
> > Moreover majority of notifiers only care about a portion of the address
> > space and there is absolutely zero reason to fail when we are unmapping an
> > unrelated range. Many notifiers do really block and wait for HW which is
> > harder to handle and we have to bail out though.
> >
> > This patch handles the low hanging fruid. __mmu_notifier_invalidate_range_start
> > gets a blockable flag and callbacks are not allowed to sleep if the
> > flag is set to false. This is achieved by using trylock instead of the
> > sleepable lock for most callbacks and continue as long as we do not
> > block down the call chain.
>
> I assume device driver developers are wondering "what does this mean
> for me".  As I understand it, the only time they will see
> blockable==false is when their driver is being called in response to an
> out-of-memory condition, yes?  So it is a very rare thing.

I can't say for everyone, but at least for me (mlx5), it is not rare event.
I'm seeing OOM very often while I'm running my tests in low memory VMs.

Thanks

>
> Any suggestions regarding how the driver developers can test this code
> path?  I don't think we presently have a way to fake an oom-killing
> event?  Perhaps we should add such a thing, given the problems we're
> having with that feature.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2018-07-17  4:03 UTC|newest]

Thread overview: 166+ 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 11:50 ` Michal Hocko
2018-07-16 11:50 ` Michal Hocko
2018-07-16 12:24 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev7) Patchwork
2018-07-16 23:12 ` [PATCH] mm, oom: distinguish blockable mode for mmu notifiers Andrew Morton
2018-07-16 23:12 ` Andrew Morton
2018-07-16 23:12   ` Andrew Morton
2018-07-17  4:03   ` Leon Romanovsky [this message]
2018-07-17  4:03     ` Leon Romanovsky
2018-07-17  4:03   ` Leon Romanovsky
2018-07-17  8:12   ` Michal Hocko
2018-07-17  8:12     ` Michal Hocko
2018-07-20 23:01     ` Andrew Morton
2018-07-20 23:01       ` Andrew Morton
2018-07-23  8:43       ` Michal Hocko
2018-07-23  8:43         ` Michal Hocko
2018-07-23  8:43       ` Michal Hocko
2018-07-20 23:01     ` Andrew Morton
2018-07-17  8:12   ` Michal Hocko
     [not found] ` <20180716115058.5559-1-mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-07-19  9:12   ` Michal Hocko
2018-07-19  9:12     ` Michal Hocko
2018-07-19  9:12 ` Michal Hocko
2018-07-21  0:09 ` Andrew Morton
2018-07-21  0:09   ` Andrew Morton
     [not found]   ` <20180720170902.d1137060c23802d55426aa03-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2018-07-23  7:03     ` Michal Hocko
2018-07-23  7:03       ` Michal Hocko
2018-07-23  7:11       ` Michal Hocko
2018-07-23  7:11         ` Michal Hocko
2018-07-23  8:11         ` Michal Hocko
2018-07-23  8:11         ` Michal Hocko
2018-07-23  8:11           ` Michal Hocko
2018-07-23  7:11       ` Michal Hocko
2018-07-24 14:17     ` Michal Hocko
2018-07-24 14:17       ` Michal Hocko
2018-07-24 19:53       ` Andrew Morton
2018-07-24 19:53         ` Andrew Morton
2018-07-25  6:17         ` Michal Hocko
2018-07-25  6:17         ` Michal Hocko
2018-07-25  6:17           ` Michal Hocko
2018-07-24 19:53       ` Andrew Morton
2018-07-24 21:07       ` David Rientjes
2018-07-24 21:07       ` David Rientjes
2018-07-24 21:07         ` David Rientjes
2018-07-25  6:13         ` Michal Hocko
2018-07-25  6:13           ` Michal Hocko
2018-07-25  6:13         ` Michal Hocko
2018-07-23  7:03   ` Michal Hocko
2018-07-24 14:17   ` Michal Hocko
2018-07-21  0:09 ` Andrew Morton
2018-07-24 14:33 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev8) Patchwork
2018-07-25 15:08 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev9) Patchwork
2018-08-24 10:54 ` [PATCH] mm, oom: distinguish blockable mode for mmu notifiers Tetsuo Handa
2018-08-24 10:54   ` Tetsuo Handa
2018-08-24 11:32   ` Michal Hocko
2018-08-24 11:32   ` Michal Hocko
2018-08-24 11:32     ` Michal Hocko
2018-08-24 11:43     ` Christian König
     [not found]     ` <20180824113248.GH29735-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2018-08-24 11:43       ` Christian König
2018-08-24 11:43         ` Christian König
2018-08-24 11:52         ` Michal Hocko
     [not found]         ` <b088e382-e90e-df63-a079-19b2ae2b985d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-24 11:52           ` Michal Hocko
2018-08-24 11:52             ` Michal Hocko
2018-08-24 11:52             ` Michal Hocko
2018-08-24 11:57             ` Christian König
     [not found]             ` <20180824115226.GK29735-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2018-08-24 11:57               ` Christian König
2018-08-24 11:57                 ` Christian König
2018-08-24 11:57                 ` Christian König
2018-08-24 12:03                 ` Michal Hocko
2018-08-24 12:03                 ` Michal Hocko
2018-08-24 12:03                   ` Michal Hocko
2018-08-24 12:03                   ` Michal Hocko
2018-08-24 12:18                   ` Christian König
     [not found]                   ` <20180824120339.GL29735-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2018-08-24 12:18                     ` Christian König
2018-08-24 12:18                       ` Christian König
2018-08-24 12:18                       ` Christian König
     [not found]                       ` <eb546bcb-9c5f-7d5d-43a7-bfde489f0e7f-5C7GfCeVMHo@public.gmane.org>
2018-08-24 12:33                         ` Michal Hocko
2018-08-24 12:33                           ` Michal Hocko
2018-08-24 12:33                           ` Michal Hocko
2018-08-24 12:52                           ` Christian König
2018-08-24 12:52                             ` Christian König
2018-08-24 12:52                             ` Christian König
     [not found]                             ` <b11df415-baf8-0a41-3c16-60dfe8d32bd3-5C7GfCeVMHo@public.gmane.org>
2018-08-24 13:01                               ` Michal Hocko
2018-08-24 13:01                                 ` Michal Hocko
2018-08-24 13:01                                 ` Michal Hocko
2018-08-24 13:10                                 ` Christian König
2018-08-24 13:10                                   ` Christian König
2018-08-24 13:10                                   ` Christian König
2018-08-24 13:24                                   ` Michal Hocko
2018-08-24 13:24                                     ` Michal Hocko
2018-08-24 13:24                                     ` Michal Hocko
2018-08-24 13:28                                     ` Christian König
2018-08-24 13:28                                     ` Christian König
2018-08-24 13:28                                       ` Christian König
2018-08-24 13:28                                       ` Christian König
2018-08-24 13:40                                       ` Michal Hocko
2018-08-24 13:40                                       ` Michal Hocko
2018-08-24 13:40                                         ` Michal Hocko
2018-08-24 13:40                                         ` Michal Hocko
2018-08-24 13:44                                         ` Christian König
2018-08-24 13:44                                           ` Christian König
2018-08-24 13:44                                           ` Christian König
2018-08-24 13:52                                           ` Michal Hocko
2018-08-24 13:52                                           ` Michal Hocko
2018-08-24 13:52                                             ` Michal Hocko
2018-08-24 13:52                                             ` Michal Hocko
2018-08-26  8:40                                             ` Tetsuo Handa
2018-08-26  8:40                                               ` Tetsuo Handa
2018-08-27  7:41                                               ` Christian König
     [not found]                                               ` <b78f8b3a-7bc6-0dea-6752-5ea798eccb6b-1yMVhJb1mP/7nzcFbJAaVXf5DAMn2ifp@public.gmane.org>
2018-08-27  7:41                                                 ` Christian König
2018-08-27  7:41                                                   ` Christian König
2018-09-06 22:46                                                   ` Tetsuo Handa
2018-09-06 22:46                                                   ` Tetsuo Handa
2018-09-06 22:46                                                     ` Tetsuo Handa
2018-09-06 22:46                                                     ` Tetsuo Handa
2018-08-26  8:40                                             ` Tetsuo Handa
2018-08-24 13:44                                         ` Christian König
2018-08-24 13:24                                   ` Michal Hocko
2018-08-24 13:10                                 ` Christian König
2018-08-24 13:01                             ` Michal Hocko
2018-08-24 12:52                           ` Christian König
2018-08-24 15:08                           ` Jerome Glisse
2018-08-24 15:08                             ` Jerome Glisse
2018-08-24 15:08                             ` Jerome Glisse
2018-08-24 15:08                           ` Jerome Glisse
2018-08-24 12:33                       ` Michal Hocko
     [not found]   ` <8cbfb09f-0c5a-8d43-1f5e-f3ff7612e289-JPay3/Yim36HaxMnTkn67Xf5DAMn2ifp@public.gmane.org>
2018-08-24 11:36     ` Michal Hocko
2018-08-24 11:36       ` Michal Hocko
2018-08-24 13:02       ` Tetsuo Handa
2018-08-24 13:02         ` Tetsuo Handa
     [not found]         ` <103b1b33-1a1d-27a1-dcf8-5c8ad60056a6-1yMVhJb1mP/7nzcFbJAaVXf5DAMn2ifp@public.gmane.org>
2018-08-24 13:32           ` Michal Hocko
2018-08-24 13:32             ` Michal Hocko
2018-08-24 14:52             ` Tetsuo Handa
2018-08-24 14:52             ` Tetsuo Handa
2018-08-24 14:52               ` Tetsuo Handa
2018-08-24 14:52               ` Tetsuo Handa
2018-08-24 15:12               ` Jerome Glisse
2018-08-24 15:12                 ` Jerome Glisse
2018-08-24 15:12                 ` Jerome Glisse
2018-08-24 16:40                 ` Michal Hocko
2018-08-24 16:40                   ` Michal Hocko
2018-08-24 16:40                   ` Michal Hocko
2018-08-24 17:33                   ` Jerome Glisse
2018-08-24 17:33                   ` Jerome Glisse
2018-08-24 17:33                     ` Jerome Glisse
2018-08-24 17:33                     ` Jerome Glisse
2018-08-24 16:40                 ` Michal Hocko
2018-08-24 15:12               ` Jerome Glisse
2018-08-24 16:38               ` Michal Hocko
2018-08-24 16:38               ` Michal Hocko
2018-08-24 16:38                 ` Michal Hocko
2018-08-24 16:38                 ` Michal Hocko
2018-08-24 13:32         ` Michal Hocko
2018-08-24 13:02       ` Tetsuo Handa
2018-08-24 11:36   ` Michal Hocko
2018-08-24 14:40   ` Jerome Glisse
2018-08-24 14:40     ` Jerome Glisse
2018-08-24 14:40     ` Jerome Glisse
2018-08-24 14:40   ` Jerome Glisse
2018-08-24 10:54 ` Tetsuo Handa
2018-08-24 11:47 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev10) Patchwork
2018-08-24 13:32 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev11) Patchwork
2018-08-24 13:43 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev12) Patchwork
2018-08-24 13:53 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev13) Patchwork
2018-08-24 17:04 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev14) Patchwork
2018-08-26  8:42 ` ✗ Fi.CI.BAT: failure for mm, oom: distinguish blockable mode for mmu notifiers (rev15) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2018-07-16 11:50 [PATCH] mm, oom: distinguish blockable mode for mmu notifiers Michal Hocko

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=20180717040347.GT3152@mtr-leonro.mtl.com \
    --to=leonro@mellanox.com \
    --cc=David1.Zhou@amd.com \
    --cc=aarcange@redhat.com \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=dennis.dalessandro@inte \
    --cc=dledford@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jgg@ziepe.ca \
    --cc=jglisse@redhat.com \
    --cc=jgross@suse.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=mike.marciniszyn@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.