All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andi Kleen <andi.kleen@intel.com>,
	Tony Luck <tony.luck@intel.com>,
	Wu Fengguang <fengguang.wu@intel.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/3] HWPOISON, hugetlbfs: fix warning on freeing hwpoisoned hugepage
Date: Thu, 6 Dec 2012 14:36:52 -0800	[thread overview]
Message-ID: <20121206143652.29c4922f.akpm@linux-foundation.org> (raw)
In-Reply-To: <1354744058-26373-2-git-send-email-n-horiguchi@ah.jp.nec.com>

On Wed,  5 Dec 2012 16:47:36 -0500
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> wrote:

> This patch fixes the warning from __list_del_entry() which is triggered
> when a process tries to do free_huge_page() for a hwpoisoned hugepage.
> 
> Originally, page->lru of hugetlbfs head page was dangling when the
> hugepage was in use. This behavior has changed by commit 0edaecfab218d7
> ("hugetlb: add a list for tracking in-use HugeTLB pages"), where hugepages
> in use are linked to hugepage_activelist. HWpoisoned hugepages should not
> be charged to any process, so we introduce another list to link hwpoisoned
> hugepages.
> 
> ...
>
> --- v3.7-rc8.orig/include/linux/hugetlb.h
> +++ v3.7-rc8/include/linux/hugetlb.h
> @@ -230,6 +230,9 @@ struct hstate {
>  	unsigned long nr_overcommit_huge_pages;
>  	struct list_head hugepage_activelist;
>  	struct list_head hugepage_freelists[MAX_NUMNODES];
> +#ifdef CONFIG_MEMORY_FAILURE
> +	struct list_head hugepage_hwpoisonedlist;
> +#endif
>  	unsigned int nr_huge_pages_node[MAX_NUMNODES];
>  	unsigned int free_huge_pages_node[MAX_NUMNODES];
>  	unsigned int surplus_huge_pages_node[MAX_NUMNODES];
> diff --git v3.7-rc8.orig/mm/hugetlb.c v3.7-rc8/mm/hugetlb.c
> index 59a0059..e61a749 100644
> --- v3.7-rc8.orig/mm/hugetlb.c
> +++ v3.7-rc8/mm/hugetlb.c
> @@ -1939,6 +1939,7 @@ void __init hugetlb_add_hstate(unsigned order)
>  	for (i = 0; i < MAX_NUMNODES; ++i)
>  		INIT_LIST_HEAD(&h->hugepage_freelists[i]);
>  	INIT_LIST_HEAD(&h->hugepage_activelist);
> +	INIT_LIST_HEAD(&h->hugepage_hwpoisonedlist);
>  	h->next_nid_to_alloc = first_node(node_states[N_HIGH_MEMORY]);
>  	h->next_nid_to_free = first_node(node_states[N_HIGH_MEMORY]);
>  	snprintf(h->name, HSTATE_NAME_LEN, "hugepages-%lukB",
> @@ -3170,7 +3171,7 @@ int dequeue_hwpoisoned_huge_page(struct page *hpage)
>  
>  	spin_lock(&hugetlb_lock);
>  	if (is_hugepage_on_freelist(hpage)) {
> -		list_del(&hpage->lru);
> +		list_move(&hpage->lru, &h->hugepage_hwpoisonedlist);
>  		set_page_refcounted(hpage);
>  		h->free_huge_pages--;
>  		h->free_huge_pages_node[nid]--;

Do we actually need to new list?  We could use list_del_init() to leave
the page's list_head pointing at itself.  In this state, it is its own
list_head and further list_del()s are a no-op.

I don't know whether this would trigger list-debug warnings.

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

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andi Kleen <andi.kleen@intel.com>,
	Tony Luck <tony.luck@intel.com>,
	Wu Fengguang <fengguang.wu@intel.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/3] HWPOISON, hugetlbfs: fix warning on freeing hwpoisoned hugepage
Date: Thu, 6 Dec 2012 14:36:52 -0800	[thread overview]
Message-ID: <20121206143652.29c4922f.akpm@linux-foundation.org> (raw)
In-Reply-To: <1354744058-26373-2-git-send-email-n-horiguchi@ah.jp.nec.com>

On Wed,  5 Dec 2012 16:47:36 -0500
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> wrote:

> This patch fixes the warning from __list_del_entry() which is triggered
> when a process tries to do free_huge_page() for a hwpoisoned hugepage.
> 
> Originally, page->lru of hugetlbfs head page was dangling when the
> hugepage was in use. This behavior has changed by commit 0edaecfab218d7
> ("hugetlb: add a list for tracking in-use HugeTLB pages"), where hugepages
> in use are linked to hugepage_activelist. HWpoisoned hugepages should not
> be charged to any process, so we introduce another list to link hwpoisoned
> hugepages.
> 
> ...
>
> --- v3.7-rc8.orig/include/linux/hugetlb.h
> +++ v3.7-rc8/include/linux/hugetlb.h
> @@ -230,6 +230,9 @@ struct hstate {
>  	unsigned long nr_overcommit_huge_pages;
>  	struct list_head hugepage_activelist;
>  	struct list_head hugepage_freelists[MAX_NUMNODES];
> +#ifdef CONFIG_MEMORY_FAILURE
> +	struct list_head hugepage_hwpoisonedlist;
> +#endif
>  	unsigned int nr_huge_pages_node[MAX_NUMNODES];
>  	unsigned int free_huge_pages_node[MAX_NUMNODES];
>  	unsigned int surplus_huge_pages_node[MAX_NUMNODES];
> diff --git v3.7-rc8.orig/mm/hugetlb.c v3.7-rc8/mm/hugetlb.c
> index 59a0059..e61a749 100644
> --- v3.7-rc8.orig/mm/hugetlb.c
> +++ v3.7-rc8/mm/hugetlb.c
> @@ -1939,6 +1939,7 @@ void __init hugetlb_add_hstate(unsigned order)
>  	for (i = 0; i < MAX_NUMNODES; ++i)
>  		INIT_LIST_HEAD(&h->hugepage_freelists[i]);
>  	INIT_LIST_HEAD(&h->hugepage_activelist);
> +	INIT_LIST_HEAD(&h->hugepage_hwpoisonedlist);
>  	h->next_nid_to_alloc = first_node(node_states[N_HIGH_MEMORY]);
>  	h->next_nid_to_free = first_node(node_states[N_HIGH_MEMORY]);
>  	snprintf(h->name, HSTATE_NAME_LEN, "hugepages-%lukB",
> @@ -3170,7 +3171,7 @@ int dequeue_hwpoisoned_huge_page(struct page *hpage)
>  
>  	spin_lock(&hugetlb_lock);
>  	if (is_hugepage_on_freelist(hpage)) {
> -		list_del(&hpage->lru);
> +		list_move(&hpage->lru, &h->hugepage_hwpoisonedlist);
>  		set_page_refcounted(hpage);
>  		h->free_huge_pages--;
>  		h->free_huge_pages_node[nid]--;

Do we actually need to new list?  We could use list_del_init() to leave
the page's list_head pointing at itself.  In this state, it is its own
list_head and further list_del()s are a no-op.

I don't know whether this would trigger list-debug warnings.

  parent reply	other threads:[~2012-12-06 22:36 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-05 21:47 [PATCH 0/3] HWPOISON, hugetlbfs: small bug fixes Naoya Horiguchi
2012-12-05 21:47 ` Naoya Horiguchi
2012-12-05 21:47 ` [PATCH 1/3] HWPOISON, hugetlbfs: fix warning on freeing hwpoisoned hugepage Naoya Horiguchi
2012-12-05 21:47   ` Naoya Horiguchi
2012-12-05 22:13   ` Luck, Tony
2012-12-05 22:13     ` Luck, Tony
2012-12-07  2:18     ` Naoya Horiguchi
2012-12-07  2:18       ` Naoya Horiguchi
2012-12-06 22:36   ` Andrew Morton [this message]
2012-12-06 22:36     ` Andrew Morton
2012-12-07  2:03     ` Naoya Horiguchi
2012-12-07  2:03       ` Naoya Horiguchi
2012-12-07  2:20       ` Andrew Morton
2012-12-07  2:20         ` Andrew Morton
2012-12-07  5:48         ` Naoya Horiguchi
2012-12-07  5:48           ` Naoya Horiguchi
2012-12-07  5:36       ` Aneesh Kumar K.V
2012-12-07  5:36         ` Aneesh Kumar K.V
2012-12-07  6:14         ` Naoya Horiguchi
2012-12-07  6:14           ` Naoya Horiguchi
2012-12-07  7:54           ` Aneesh Kumar K.V
2012-12-07  7:54             ` Aneesh Kumar K.V
2012-12-07 15:49             ` Naoya Horiguchi
2012-12-07 15:49               ` Naoya Horiguchi
2012-12-07 22:34               ` Andrew Morton
2012-12-07 22:34                 ` Andrew Morton
2012-12-08 21:04                 ` Naoya Horiguchi
2012-12-08 21:04                   ` Naoya Horiguchi
2012-12-05 21:47 ` [PATCH 2/3] HWPOISON, hugetlbfs: fix "bad pmd" warning in unmapping " Naoya Horiguchi
2012-12-05 21:47   ` Naoya Horiguchi
2012-12-05 21:47 ` [PATCH 3/3] HWPOISON, hugetlbfs: fix RSS-counter warning Naoya Horiguchi
2012-12-05 21:47   ` Naoya Horiguchi
2012-12-05 22:04   ` Luck, Tony
2012-12-05 22:04     ` Luck, Tony
2012-12-05 22:14     ` Naoya Horiguchi
2012-12-05 22:14       ` Naoya Horiguchi
2012-12-06 22:40       ` Andrew Morton
2012-12-06 22:40         ` Andrew Morton
2012-12-07  1:22         ` Naoya Horiguchi
2012-12-07  1:22           ` Naoya Horiguchi
2012-12-07  2:10           ` Andrew Morton
2012-12-07  2:10             ` Andrew Morton
2012-12-10 11:17   ` Simon Jeons
2012-12-10 11:17     ` Simon Jeons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121206143652.29c4922f.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=andi.kleen@intel.com \
    --cc=fengguang.wu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.