[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9072d352-7a07-aac7-3439-3f524fc465ed@oracle.com>
Date: Mon, 3 Aug 2020 16:00:52 -0700
From: Mike Kravetz <mike.kravetz@...cle.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Michal Hocko <mhocko@...nel.org>,
Hugh Dickins <hughd@...gle.com>,
Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
Andrea Arcangeli <aarcange@...hat.com>,
"Kirill A.Shutemov" <kirill.shutemov@...ux.intel.com>,
Davidlohr Bueso <dave@...olabs.net>,
Prakash Sangappa <prakash.sangappa@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
stable@...r.kernel.org
Subject: Re: [PATCH] hugetlbfs: remove call to huge_pte_alloc without
i_mmap_rwsem
On 8/3/20 3:52 PM, Matthew Wilcox wrote:
> On Mon, Aug 03, 2020 at 03:43:35PM -0700, Mike Kravetz wrote:
>> Commit c0d0381ade79 ("hugetlbfs: use i_mmap_rwsem for more pmd sharing
>> synchronization") requires callers of huge_pte_alloc to hold i_mmap_rwsem
>> in at least read mode. This is because the explicit locking in
>> huge_pmd_share (called by huge_pte_alloc) was removed. When restructuring
>> the code, the call to huge_pte_alloc in the else block at the beginning
>> of hugetlb_fault was missed.
>
> Should we have a call to mmap_assert_locked() in huge_pte_alloc(),
> at least the generic one?
That is the wrong semaphore.
However, I was not aware of the checks for a semaphore being held as is
done in rwsem_is_locked(). That would have caught this when the original
code was changed. Thanks for pointing this out.
Let me update the patch and add checks to huge_pmd_share().
--
Mike Kravetz
Powered by blists - more mailing lists