[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210710002441.167759-1-mike.kravetz@oracle.com>
Date: Fri, 9 Jul 2021 17:24:38 -0700
From: Mike Kravetz <mike.kravetz@...cle.com>
To: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Cc: Muchun Song <songmuchun@...edance.com>,
Michal Hocko <mhocko@...e.com>,
Oscar Salvador <osalvador@...e.de>,
David Hildenbrand <david@...hat.com>,
Matthew Wilcox <willy@...radead.org>,
Naoya Horiguchi <naoya.horiguchi@...ux.dev>,
Mina Almasry <almasrymina@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Mike Kravetz <mike.kravetz@...cle.com>
Subject: [PATCH 0/3] hugetlb: fix potential ref counting races
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(-)
--
2.31.1
Powered by blists - more mailing lists