From: Mike Kravetz <mike.kravetz@oracle.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Muchun Song <songmuchun@bytedance.com>,
Michal Hocko <mhocko@suse.com>,
Oscar Salvador <osalvador@suse.de>,
David Hildenbrand <david@redhat.com>,
Matthew Wilcox <willy@infradead.org>,
Naoya Horiguchi <naoya.horiguchi@linux.dev>,
Mina Almasry <almasrymina@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 0/3] hugetlb: fix potential ref counting races
Date: Tue, 27 Jul 2021 16:41:51 -0700 [thread overview]
Message-ID: <22abb0f0-ce85-3567-3bfd-74dd1450c14f@oracle.com> (raw)
In-Reply-To: <20210710002441.167759-1-mike.kravetz@oracle.com>
Any additional comments on these patches/this approach?
The first patch addressing this issue actually went into the 5.14 merge
window as commit 7118fc2906e2 ("hugetlb: address ref count racing in
prep_compound_gigantic_page").
All this code is very tricky and subtle. It addresses potential issues
discovered by code analysis. I do not believe the races have ever been
experienced in practice. If anyone has suggestions for a simpler or
alternative approach, I would love to hear them.
--
Mike Kravetz
On 7/9/21 5:24 PM, Mike Kravetz wrote:
> When Muchun Song brought up a potential issue with hugetlb ref counting[1],
> I started looking closer at the code. hugetlbfs is the only code with it's
> own specialized compound page destructor and taking special action when ref
> counts drop to zero. Potential races happen in this unique handling of ref
> counts. The following patches address these races when creating and
> destroying hugetlb pages.
>
> These potential races have likely existed since the creation of
> hugetlbfs. They certainly have been around for more than 10 years.
> However, I am unaware of anyone actually hitting these races. It is
> VERY unlikely than anyone will actually hit these races, but they do
> exist.
>
> I could not think of an easy (or difficult) way to force these races.
> Therefore, testing consisted of adding code to randomly increase ref
> counts in strategic places. In this way, I was able to exercise all the
> race handling code paths.
>
> [1] https://lore.kernel.org/linux-mm/CAMZfGtVMn3daKrJwZMaVOGOaJU+B4dS--x_oPmGQMD=c=QNGEg@mail.gmail.com/
>
> Mike Kravetz (3):
> hugetlb: simplify prep_compound_gigantic_page ref count racing code
> hugetlb: drop ref count earlier after page allocation
> hugetlb: before freeing hugetlb page set dtor to appropriate value
>
> mm/hugetlb.c | 137 ++++++++++++++++++++++++++++++++++++++-------------
> 1 file changed, 104 insertions(+), 33 deletions(-)
>
next prev parent reply other threads:[~2021-07-27 23:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-10 0:24 [PATCH 0/3] hugetlb: fix potential ref counting races Mike Kravetz
2021-07-10 0:24 ` [PATCH 1/3] hugetlb: simplify prep_compound_gigantic_page ref count racing code Mike Kravetz
2021-07-13 6:31 ` [External] " Muchun Song
2021-07-10 0:24 ` [PATCH 2/3] hugetlb: drop ref count earlier after page allocation Mike Kravetz
2021-07-10 0:24 ` [PATCH 3/3] hugetlb: before freeing hugetlb page set dtor to appropriate value Mike Kravetz
2021-07-14 10:57 ` [External] " Muchun Song
2021-07-14 17:39 ` Mike Kravetz
2021-07-15 3:14 ` Muchun Song
2021-07-27 23:41 ` Mike Kravetz [this message]
2021-07-28 4:03 ` [PATCH 0/3] hugetlb: fix potential ref counting races Muchun Song
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=22abb0f0-ce85-3567-3bfd-74dd1450c14f@oracle.com \
--to=mike.kravetz@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=almasrymina@google.com \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=naoya.horiguchi@linux.dev \
--cc=osalvador@suse.de \
--cc=songmuchun@bytedance.com \
--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;
as well as URLs for NNTP newsgroup(s).