linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] mm: hugetlb: remove incorrect comment
@ 2016-07-19  2:08 Naoya Horiguchi
  2016-07-19  9:10 ` Michal Hocko
  0 siblings, 1 reply; 4+ messages in thread
From: Naoya Horiguchi @ 2016-07-19  2:08 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Zhan Chen, linux-mm, linux-kernel, Naoya Horiguchi, Naoya Horiguchi

dequeue_hwpoisoned_huge_page() can be called without page lock hold,
so let's remove incorrect comment.

Reported-by: Zhan Chen <zhanc1@andrew.cmu.edu>
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
 mm/hugetlb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git v4.7-rc7/mm/hugetlb.c v4.7-rc7_patched/mm/hugetlb.c
index c1f3c0b..26f735c 100644
--- v4.7-rc7/mm/hugetlb.c
+++ v4.7-rc7_patched/mm/hugetlb.c
@@ -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)
 {
-- 
2.7.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] mm: hugetlb: remove incorrect comment
  2016-07-19  2:08 [PATCH v1] mm: hugetlb: remove incorrect comment Naoya Horiguchi
@ 2016-07-19  9:10 ` Michal Hocko
  2016-07-20  9:29   ` Naoya Horiguchi
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Hocko @ 2016-07-19  9:10 UTC (permalink / raw)
  To: Naoya Horiguchi
  Cc: Andrew Morton, Zhan Chen, linux-mm, linux-kernel, Naoya Horiguchi

On Tue 19-07-16 11:08:18, Naoya Horiguchi wrote:
> 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!

> 
> Reported-by: Zhan Chen <zhanc1@andrew.cmu.edu>
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> ---
>  mm/hugetlb.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git v4.7-rc7/mm/hugetlb.c v4.7-rc7_patched/mm/hugetlb.c
> index c1f3c0b..26f735c 100644
> --- v4.7-rc7/mm/hugetlb.c
> +++ v4.7-rc7_patched/mm/hugetlb.c
> @@ -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)
>  {
> -- 
> 2.7.0
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] mm: hugetlb: remove incorrect comment
  2016-07-19  9:10 ` Michal Hocko
@ 2016-07-20  9:29   ` Naoya Horiguchi
  2016-07-20  9:41     ` Michal Hocko
  0 siblings, 1 reply; 4+ messages in thread
From: Naoya Horiguchi @ 2016-07-20  9:29 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Naoya Horiguchi, Andrew Morton, Zhan Chen, linux-mm, linux-kernel

On Tue, Jul 19, 2016 at 11:10:53AM +0200, Michal Hocko wrote:
> On Tue 19-07-16 11:08:18, Naoya Horiguchi wrote:
> > 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
---

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] mm: hugetlb: remove incorrect comment
  2016-07-20  9:29   ` Naoya Horiguchi
@ 2016-07-20  9:41     ` Michal Hocko
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2016-07-20  9:41 UTC (permalink / raw)
  To: Naoya Horiguchi
  Cc: Naoya Horiguchi, Andrew Morton, Zhan Chen, linux-mm, linux-kernel

On Wed 20-07-16 18:29:02, Naoya Horiguchi wrote:
[...]
> >From 7da52ca6920dcd84e3da2df619bd5242f9c3ccec Mon Sep 17 00:00:00 2001
> From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Date: Wed, 20 Jul 2016 18:21:33 +0900
> Subject: [PATCH v2] mm: hwpoison: remove incorrect comment
> 
> 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() 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.

Thank you for the clarification!

> Reported-by: Zhan Chen <zhanc1@andrew.cmu.edu>
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  mm/hugetlb.c        | 1 -
>  mm/memory-failure.c | 2 --
>  2 files changed, 3 deletions(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index c1f3c0be150a..26f735cc7478 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -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)
>  {
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 2fcca6b0e005..7532c3a8a39c 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -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);
> -- 
> 2.7.4
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-20  9:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-19  2:08 [PATCH v1] mm: hugetlb: remove incorrect comment Naoya Horiguchi
2016-07-19  9:10 ` Michal Hocko
2016-07-20  9:29   ` Naoya Horiguchi
2016-07-20  9:41     ` Michal Hocko

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).