mm, hugetlbfs: Fix new warning in fault-time huge page allocation
Subsystems (2)
PATCH 1/1 mm, hugetlbfs: Fix new warning in fault-time huge page allocation
From: Dave Hansen <[email protected]>
Kirill reported that he hit:
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (vma || addr) { + WARN_ON_ONCE(!addr || addr == -1);Trinity triggered the WARN for me:
This was just a dumb mistake. I put the WARN_ON() in and planned to have addr=0 mean "use nid". But, I realized pretty quickly that addr=0 _is_ a valid place to fault. So I made it addr=-1 in __alloc_buddy_huge_page_no_mpol(), but I did not fix up the WARN_ON().
So hitting the warning in this case was harmless. But, fix up the warning condition.
Cc Kirill A. Shutemov <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Naoya Horiguchi <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Hillf Danton <[email protected]>
Cc David Rientjes <[email protected]>
Signed-off-by Dave Hansen <[email protected]>
---
b/mm/hugetlb.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
mm/hugetlb.c renamed from mm/hugetlb.c~hugetlbfs-fix-warn +8 -2
@@ -1520,8 +1520,14 @@ static struct page *__alloc_buddy_huge_pif (hstate_is_gigantic (h))return NULL ; -if (vma || addr) { -VM_WARN_ON_ONCE (!addr || addr ==-1 ); +/* +* Make sure that anyone specifying 'nid' is not also +* specifying a VMA. This makes sure the caller is +* picking _one_ of the modes with which we can call this +* function, not both. +*/ +if (vma || (addr !=-1 )) { +VM_WARN_ON_ONCE (addr ==-1 );VM_WARN_ON_ONCE (nid !=NUMA_NO_NODE ); }/*
_