All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Wanpeng Li <wanpeng.li@hotmail.com>,
	Andi Kleen <andi@firstfloor.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Hugh Dickins <hughd@google.com>,
	Sasha Levin <sasha.levin@oracle.com>,
	Minchan Kim <minchan@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Naoya Horiguchi <nao.horiguchi@gmail.com>
Subject: Re: [PATCH v2] mm: hwpoison: adjust for new thp refcounting
Date: Fri, 6 Nov 2015 12:34:43 +0200	[thread overview]
Message-ID: <20151106103442.GB6463@node.shutemov.name> (raw)
In-Reply-To: <1446796992-15798-1-git-send-email-n-horiguchi@ah.jp.nec.com>

On Fri, Nov 06, 2015 at 05:03:12PM +0900, Naoya Horiguchi wrote:
> Some mm-related BUG_ON()s could trigger from hwpoison code due to recent
> changes in thp refcounting rule. This patch fixes them up.
> 
> In the new refcounting, we no longer use tail->_mapcount to keep tail's
> refcount, and thereby we can simplify get/put_hwpoison_page().
> 
> And another change is that tail's refcount is not transferred to the raw
> page during thp split (more precisely, in new rule we don't take refcount
> on tail page any more.) So when we need thp split, we have to transfer the
> refcount properly to the 4kB soft-offlined page before migration.
> 
> thp split code goes into core code only when precheck (total_mapcount(head)
> == page_count(head) - 1) passes to avoid useless split, where we assume that
> one refcount is held by the caller of thp split and the others are taken
> via mapping. To meet this assumption, this patch moves thp split part in
> soft_offline_page() after get_any_page().
> 
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> ---
> ChangeLog v1->v2:
> - leave put_hwpoison_page() as a macro
> 
> - based on mmotm-2015-10-21-14-41 + Kirill's "[PATCH 0/4] Bugfixes for THP
>   refcounting" series.
> ---
>  include/linux/mm.h  |    1 +
>  mm/memory-failure.c |   75 +++++++++++++++------------------------------------
>  2 files changed, 23 insertions(+), 53 deletions(-)
> 
> diff --git mmotm-2015-10-21-14-41/include/linux/mm.h mmotm-2015-10-21-14-41_patched/include/linux/mm.h
> index a36f9fa..51e3ffe 100644
> --- mmotm-2015-10-21-14-41/include/linux/mm.h
> +++ mmotm-2015-10-21-14-41_patched/include/linux/mm.h
> @@ -2173,6 +2173,7 @@ extern int memory_failure(unsigned long pfn, int trapno, int flags);
>  extern void memory_failure_queue(unsigned long pfn, int trapno, int flags);
>  extern int unpoison_memory(unsigned long pfn);
>  extern int get_hwpoison_page(struct page *page);
> +#define put_hwpoison_page(page)	put_page(page)
>  extern void put_hwpoison_page(struct page *page);

This line should be removed.

Otherwise looks good to me.

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
 Kirill A. Shutemov

--
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: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Wanpeng Li <wanpeng.li@hotmail.com>,
	Andi Kleen <andi@firstfloor.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Hugh Dickins <hughd@google.com>,
	Sasha Levin <sasha.levin@oracle.com>,
	Minchan Kim <minchan@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Naoya Horiguchi <nao.horiguchi@gmail.com>
Subject: Re: [PATCH v2] mm: hwpoison: adjust for new thp refcounting
Date: Fri, 6 Nov 2015 12:34:43 +0200	[thread overview]
Message-ID: <20151106103442.GB6463@node.shutemov.name> (raw)
In-Reply-To: <1446796992-15798-1-git-send-email-n-horiguchi@ah.jp.nec.com>

On Fri, Nov 06, 2015 at 05:03:12PM +0900, Naoya Horiguchi wrote:
> Some mm-related BUG_ON()s could trigger from hwpoison code due to recent
> changes in thp refcounting rule. This patch fixes them up.
> 
> In the new refcounting, we no longer use tail->_mapcount to keep tail's
> refcount, and thereby we can simplify get/put_hwpoison_page().
> 
> And another change is that tail's refcount is not transferred to the raw
> page during thp split (more precisely, in new rule we don't take refcount
> on tail page any more.) So when we need thp split, we have to transfer the
> refcount properly to the 4kB soft-offlined page before migration.
> 
> thp split code goes into core code only when precheck (total_mapcount(head)
> == page_count(head) - 1) passes to avoid useless split, where we assume that
> one refcount is held by the caller of thp split and the others are taken
> via mapping. To meet this assumption, this patch moves thp split part in
> soft_offline_page() after get_any_page().
> 
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> ---
> ChangeLog v1->v2:
> - leave put_hwpoison_page() as a macro
> 
> - based on mmotm-2015-10-21-14-41 + Kirill's "[PATCH 0/4] Bugfixes for THP
>   refcounting" series.
> ---
>  include/linux/mm.h  |    1 +
>  mm/memory-failure.c |   75 +++++++++++++++------------------------------------
>  2 files changed, 23 insertions(+), 53 deletions(-)
> 
> diff --git mmotm-2015-10-21-14-41/include/linux/mm.h mmotm-2015-10-21-14-41_patched/include/linux/mm.h
> index a36f9fa..51e3ffe 100644
> --- mmotm-2015-10-21-14-41/include/linux/mm.h
> +++ mmotm-2015-10-21-14-41_patched/include/linux/mm.h
> @@ -2173,6 +2173,7 @@ extern int memory_failure(unsigned long pfn, int trapno, int flags);
>  extern void memory_failure_queue(unsigned long pfn, int trapno, int flags);
>  extern int unpoison_memory(unsigned long pfn);
>  extern int get_hwpoison_page(struct page *page);
> +#define put_hwpoison_page(page)	put_page(page)
>  extern void put_hwpoison_page(struct page *page);

This line should be removed.

Otherwise looks good to me.

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
 Kirill A. Shutemov

  reply	other threads:[~2015-11-06 10:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06  6:11 [PATCH v1] mm: hwpoison: adjust for new thp refcounting Naoya Horiguchi
2015-11-06  6:11 ` Naoya Horiguchi
2015-11-06  6:31 ` Sasha Levin
2015-11-06  6:31   ` Sasha Levin
2015-11-06  6:47   ` Naoya Horiguchi
2015-11-06  6:47     ` Naoya Horiguchi
2015-11-06  8:03     ` [PATCH v2] " Naoya Horiguchi
2015-11-06  8:03       ` Naoya Horiguchi
2015-11-06 10:34       ` Kirill A. Shutemov [this message]
2015-11-06 10:34         ` Kirill A. Shutemov
2015-11-09  9:09     ` [PATCH v1] hugetlb: trivial comment fix Naoya Horiguchi
2015-11-09  9:09       ` Naoya Horiguchi

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=20151106103442.GB6463@node.shutemov.name \
    --to=kirill@shutemov.name \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=hughd@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=nao.horiguchi@gmail.com \
    --cc=sasha.levin@oracle.com \
    --cc=wanpeng.li@hotmail.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.