From: Mike Kravetz <firstname.lastname@example.org> To: email@example.com, firstname.lastname@example.org Cc: Muchun Song <email@example.com>, Michal Hocko <firstname.lastname@example.org>, Oscar Salvador <email@example.com>, David Hildenbrand <firstname.lastname@example.org>, Matthew Wilcox <email@example.com>, Naoya Horiguchi <firstname.lastname@example.org>, Mina Almasry <email@example.com>, Andrew Morton <firstname.lastname@example.org>, Mike Kravetz <email@example.com> Subject: [PATCH 0/3] hugetlb: fix potential ref counting races Date: Fri, 9 Jul 2021 17:24:38 -0700 [thread overview] Message-ID: <firstname.lastname@example.org> (raw) When Muchun Song brought up a potential issue with hugetlb ref counting, 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.  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(-) -- 2.31.1
next reply other threads:[~2021-07-10 0:25 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-10 0:24 Mike Kravetz [this message] 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 ` [PATCH 0/3] hugetlb: fix potential ref counting races Mike Kravetz 2021-07-28 4:03 ` 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 \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: [PATCH 0/3] hugetlb: fix potential ref counting races' \ /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
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).