[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1576529149-14269-4-git-send-email-akaher@vmware.com>
Date: Tue, 17 Dec 2019 02:15:43 +0530
From: Ajay Kaher <akaher@...are.com>
To: <gregkh@...uxfoundation.org>
CC: <torvalds@...ux-foundation.org>, <punit.agrawal@....com>,
<akpm@...ux-foundation.org>, <kirill.shutemov@...ux.intel.com>,
<willy@...radead.org>, <will.deacon@....com>,
<mszeredi@...hat.com>, <stable@...r.kernel.org>,
<linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
<srivatsab@...are.com>, <srivatsa@...il.mit.edu>,
<amakhalov@...are.com>, <srinidhir@...are.com>,
<bvikas@...are.com>, <anishs@...are.com>, <vsirnapalli@...are.com>,
<srostedt@...are.com>, <akaher@...are.com>,
"Aneesh Kumar K . V" <aneesh.kumar@...ux.vnet.ibm.com>,
Catalin Marinas <catalin.marinas@....com>,
Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
Mark Rutland <mark.rutland@....com>,
Hillf Danton <hillf.zj@...baba-inc.com>,
Michal Hocko <mhocko@...e.com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>
Subject: [PATCH v3 3/8] mm, gup: remove broken VM_BUG_ON_PAGE compound check for hugepages
From: Will Deacon <will.deacon@....com>
commit a3e328556d41bb61c55f9dfcc62d6a826ea97b85 upstream.
When operating on hugepages with DEBUG_VM enabled, the GUP code checks
the compound head for each tail page prior to calling
page_cache_add_speculative. This is broken, because on the fast-GUP
path (where we don't hold any page table locks) we can be racing with a
concurrent invocation of split_huge_page_to_list.
split_huge_page_to_list deals with this race by using page_ref_freeze to
freeze the page and force concurrent GUPs to fail whilst the component
pages are modified. This modification includes clearing the
compound_head field for the tail pages, so checking this prior to a
successful call to page_cache_add_speculative can lead to false
positives: In fact, page_cache_add_speculative *already* has this check
once the page refcount has been successfully updated, so we can simply
remove the broken calls to VM_BUG_ON_PAGE.
Link: http://lkml.kernel.org/r/20170522133604.11392-2-punit.agrawal@arm.com
Signed-off-by: Will Deacon <will.deacon@....com>
Signed-off-by: Punit Agrawal <punit.agrawal@....com>
Acked-by: Steve Capper <steve.capper@....com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
Cc: Catalin Marinas <catalin.marinas@....com>
Cc: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
Cc: Mark Rutland <mark.rutland@....com>
Cc: Hillf Danton <hillf.zj@...baba-inc.com>
Cc: Michal Hocko <mhocko@...e.com>
Cc: Mike Kravetz <mike.kravetz@...cle.com>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Srivatsa S. Bhat (VMware) <srivatsa@...il.mit.edu>
Signed-off-by: Ajay Kaher <akaher@...are.com>
Signed-off-by: Vlastimil Babka <vbabka@...e.cz>
---
mm/gup.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/mm/gup.c b/mm/gup.c
index 45c544b..6e7cfaa 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1136,7 +1136,6 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr,
page = head + ((addr & ~PMD_MASK) >> PAGE_SHIFT);
tail = page;
do {
- VM_BUG_ON_PAGE(compound_head(page) != head, page);
pages[*nr] = page;
(*nr)++;
page++;
@@ -1183,7 +1182,6 @@ static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr,
page = head + ((addr & ~PUD_MASK) >> PAGE_SHIFT);
tail = page;
do {
- VM_BUG_ON_PAGE(compound_head(page) != head, page);
pages[*nr] = page;
(*nr)++;
page++;
@@ -1226,7 +1224,6 @@ static int gup_huge_pgd(pgd_t orig, pgd_t *pgdp, unsigned long addr,
page = head + ((addr & ~PGDIR_MASK) >> PAGE_SHIFT);
tail = page;
do {
- VM_BUG_ON_PAGE(compound_head(page) != head, page);
pages[*nr] = page;
(*nr)++;
page++;
--
2.7.4
Powered by blists - more mailing lists