[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d2d8d6a8-7ac5-8f04-c11a-61140fccc5e1@nvidia.com>
Date: Wed, 14 Aug 2019 13:32:13 -0700
From: Ralph Campbell <rcampbell@...dia.com>
To: Jason Gunthorpe <jgg@...pe.ca>, <linux-mm@...ck.org>
CC: Andrea Arcangeli <aarcange@...hat.com>,
Christoph Hellwig <hch@....de>,
John Hubbard <jhubbard@...dia.com>,
Jérôme Glisse <jglisse@...hat.com>,
"Kuehling, Felix" <Felix.Kuehling@....com>,
"Alex Deucher" <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
"David (ChunMing) Zhou" <David1.Zhou@....com>,
Dimitri Sivanich <sivanich@....com>,
<dri-devel@...ts.freedesktop.org>, <amd-gfx@...ts.freedesktop.org>,
<linux-kernel@...r.kernel.org>, <linux-rdma@...r.kernel.org>,
<iommu@...ts.linux-foundation.org>,
<intel-gfx@...ts.freedesktop.org>,
Gavin Shan <shangw@...ux.vnet.ibm.com>,
Andrea Righi <andrea@...terlinux.com>,
Jason Gunthorpe <jgg@...lanox.com>
Subject: Re: [PATCH v3 hmm 02/11] mm/mmu_notifiers: do not speculatively
allocate a mmu_notifier_mm
On 8/6/19 4:15 PM, Jason Gunthorpe wrote:
> From: Jason Gunthorpe <jgg@...lanox.com>
>
> A prior commit e0f3c3f78da2 ("mm/mmu_notifier: init notifier if necessary")
> made an attempt at doing this, but had to be reverted as calling
> the GFP_KERNEL allocator under the i_mmap_mutex causes deadlock, see
> commit 35cfa2b0b491 ("mm/mmu_notifier: allocate mmu_notifier in advance").
>
> However, we can avoid that problem by doing the allocation only under
> the mmap_sem, which is already happening.
>
> Since all writers to mm->mmu_notifier_mm hold the write side of the
> mmap_sem reading it under that sem is deterministic and we can use that to
> decide if the allocation path is required, without speculation.
>
> The actual update to mmu_notifier_mm must still be done under the
> mm_take_all_locks() to ensure read-side coherency.
>
> Signed-off-by: Jason Gunthorpe <jgg@...lanox.com>
Looks good to me.
Reviewed-by: Ralph Campbell <rcampbell@...dia.com>
Powered by blists - more mailing lists