mm: hugetlb: remove incorrect comment
Subsystems (2)
PATCH 1/1 mm: hugetlb: remove incorrect comment
dequeue_hwpoisoned_huge_page() can be called without page lock hold, so let's remove incorrect comment.
--- mm/hugetlb.c | 1 - 1 file changed, 1 deletion(-)
mm/hugetlb.c +0 -1
@@ -4401,7 +4401,6 @@ follow_huge_pud(struct mm_struct *mm, unsigned long address,/* * This function is called from memory failure code. -* Assume the caller holds page lock of the head page. */ int dequeue_hwpoisoned_huge_page (struct page *hpage) {
Signature · 7 lines
2.7.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 2 lines · Naoya Horiguchi
dequeue_hwpoisoned_huge_page()can be called without page lock hold, so let's remove incorrect comment.
Could you explain why the page lock is not really needed, please? Or what has changed that it is not needed anymore?
Thanks!
Quoted 27 lines
Reported-by Zhan Chen <[email protected]>Signed-off-by Naoya Horiguchi <[email protected]>--- mm/hugetlb.c | 1 - 1 file changed, 1 deletion(-)mm/hugetlb.c +0
-1@@ -4401,7 +4401,6 @@ follow_huge_pud(struct mm_struct *mm, unsigned long address,/* * This function is called from memory failure code. -* Assume the caller holds page lock of the head page. */ int dequeue_hwpoisoned_huge_page (struct page *hpage) {Signature · 7 lines
2.7.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Michal Hocko
Quoted 2 lines · Naoya Horiguchi
dequeue_hwpoisoned_huge_page()can be called without page lock hold, so let's remove incorrect comment.Could you explain why the page lock is not really needed, please? Or what has changed that it is not needed anymore?
The reason is that dequeue_hwpoisoned_huge_page checks page_huge_active() inside hugetlb_lock, which allows us to avoid trying to dequeue a hugepage that are just allocated but not linked to active list yet, even without taking page lock.
Your question makes me aware of another comment to be removed, so let me update this.
Thanks,
Naoya Horiguchi
---
Michal Hocko
Acked-byOn Wed 20-07-16 18:29:02, Naoya Horiguchi wrote:
[...]
Quoted 5 lines
Quoted 1 line
From
7da52ca6920dcd84e3da2df619bd5242f9c3ccecMon Sep 17 00:00:00 2001From: Naoya Horiguchi <[email protected]>
Date: Wed, 20 Jul 2016 18:21:33 +0900
Subject: [PATCH v2] mm: hwpoison: remove incorrect comment
Quoted 7 lines
dequeue_hwpoisoned_huge_page()can be called without page lock hold, so let's remove incorrect comment.The reason why the page lock is not really needed is that
dequeue_hwpoisoned_huge_page()checkspage_huge_active()insidehugetlb_lock, which allows us to avoid trying to dequeue a hugepage that are just allocated but not linked to active list yet, even without taking page lock.
Thank you for the clarification!
Quoted 2 lines
Reported-by Zhan Chen <[email protected]>Signed-off-by Naoya Horiguchi <[email protected]>
Quoted 38 lines
--- mm/hugetlb.c | 1 - mm/memory-failure.c | 2 -- 2 files changed, 3 deletions(-)mm/hugetlb.c +0
-1@@ -4401,7 +4401,6 @@ follow_huge_pud(struct mm_struct *mm, unsigned long address,/* * This function is called from memory failure code. -* Assume the caller holds page lock of the head page. */ int dequeue_hwpoisoned_huge_page (struct page *hpage) {mm/memory-failure.c +0
-2@@ -741,8 +741,6 @@ static int me_huge_page(struct page *p, unsigned long pfn)* page->lru because it can be used in other hugepage operations, * such as __unmap_hugepage_range() and gather_surplus_pages(). * So instead we use page_mapping() and PageAnon(). -* We assume that this function is called with page lock held, -* so there is no race between isolation and mapping/unmapping. */ if (!(page_mapping (hpage) ||PageAnon (hpage))) { res =dequeue_hwpoisoned_huge_page (hpage);Signature · 7 lines
2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>