From: Mike Kravetz <mike.kravetz@oracle.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Michal Hocko <mhocko@kernel.org>, Hugh Dickins <hughd@google.com>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
Andrea Arcangeli <aarcange@redhat.com>,
"Kirill A.Shutemov" <kirill.shutemov@linux.intel.com>,
Davidlohr Bueso <dave@stgolabs.net>,
Prakash Sangappa <prakash.sangappa@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>,
stable@vger.kernel.org
Subject: Re: [PATCH] hugetlbfs: remove call to huge_pte_alloc without i_mmap_rwsem
Date: Mon, 3 Aug 2020 16:00:52 -0700 [thread overview]
Message-ID: <9072d352-7a07-aac7-3439-3f524fc465ed@oracle.com> (raw)
In-Reply-To: <20200803225234.GD23808@casper.infradead.org>
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
next prev parent reply other threads:[~2020-08-03 23:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-03 22:43 Mike Kravetz
2020-08-03 22:52 ` Matthew Wilcox
2020-08-03 23:00 ` Mike Kravetz [this message]
2020-08-04 2:03 ` Mike Kravetz
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=9072d352-7a07-aac7-3439-3f524fc465ed@oracle.com \
--to=mike.kravetz@oracle.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=dave@stgolabs.net \
--cc=hughd@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=prakash.sangappa@oracle.com \
--cc=stable@vger.kernel.org \
--cc=willy@infradead.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