linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andi Kleen <andi@firstfloor.org>,
	Fengguang Wu <fengguang.wu@intel.com>,
	Tony Luck <tony.luck@intel.com>,
	gong.chen@linux.intel.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] mm/hwpoison: fix miss catch transparent huge page
Date: Mon, 02 Sep 2013 14:34:20 -0400	[thread overview]
Message-ID: <1378146860-wzqztoop-mutt-n-horiguchi@ah.jp.nec.com> (raw)
In-Reply-To: <1378125224-12794-2-git-send-email-liwanp@linux.vnet.ibm.com>

On Mon, Sep 02, 2013 at 08:33:42PM +0800, Wanpeng Li wrote:
> PageTransHuge() can't guarantee the page is transparent huge page since it 
> return true for both transparent huge and hugetlbfs pages. This patch fix 
> it by check the page is also !hugetlbfs page.
> 
> Before patch:
> 
> [  121.571128] Injecting memory failure at pfn 23a200
> [  121.571141] MCE 0x23a200: huge page recovery: Delayed
> [  140.355100] MCE: Memory failure is now running on 0x23a200
> 
> After patch:
> 
> [   94.290793] Injecting memory failure at pfn 23a000
> [   94.290800] MCE 0x23a000: huge page recovery: Delayed
> [  105.722303] MCE: Software-unpoisoned page 0x23a000
> 
> Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>

PageTransHuge doesn't care about hugetlbfs at all, assuming that it
shouldn't be called hugetlbfs context as commented.

  /*                                                                    
   * PageHuge() only returns true for hugetlbfs pages, but not for      
   * normal or transparent huge pages.                                  
   *                                                                    
   * PageTransHuge() returns true for both transparent huge and         
   * hugetlbfs pages, but not normal pages. PageTransHuge() can only be 
   * called only in the core VM paths where hugetlbfs pages can't exist.
   */
  static inline int PageTransHuge(struct page *page)

I think it's for the ultra optimization of thp, so we can't change that.
So we need to follow the pattern whenever possible.

  if (PageHuge) {
    hugetlb specific code
  } else if (PageTransHuge) {
    thp specific code
  }
  normal page code / common code

> ---
>  mm/memory-failure.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index e28ee77..b114570 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1349,7 +1349,7 @@ int unpoison_memory(unsigned long pfn)
>  	 * worked by memory_failure() and the page lock is not held yet.
>  	 * In such case, we yield to memory_failure() and make unpoison fail.
>  	 */
> -	if (PageTransHuge(page)) {
> +	if (PageTransHuge(page) && !PageHuge(page)) {
>  		pr_info("MCE: Memory failure is now running on %#lx\n", pfn);
>  			return 0;
>  	}

I think that we can effectively follow the above pattern by reversing
these two checks.

Thanks,
Naoya Horiguchi

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

  reply	other threads:[~2013-09-02 18:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-02 12:33 [PATCH 1/4] mm/hwpoison: fix traverse hugetlbfs page to avoid printk flood Wanpeng Li
2013-09-02 12:33 ` [PATCH 2/4] mm/hwpoison: fix miss catch transparent huge page Wanpeng Li
2013-09-02 18:34   ` Naoya Horiguchi [this message]
2013-09-02 23:31     ` Wanpeng Li
2013-09-02 23:31     ` Wanpeng Li
2013-09-02 12:33 ` [PATCH 3/4] mm/hwpoison: fix false report 2nd try page recovery Wanpeng Li
2013-09-02 18:34   ` Naoya Horiguchi
2013-09-02 12:33 ` [PATCH 4/4] mm/hwpoison: fix the lack of one reference count against poisoned page Wanpeng Li
2013-09-02 18:34   ` Naoya Horiguchi
2013-09-02 18:34 ` [PATCH 1/4] mm/hwpoison: fix traverse hugetlbfs page to avoid printk flood 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=1378146860-wzqztoop-mutt-n-horiguchi@ah.jp.nec.com \
    --to=n-horiguchi@ah.jp.nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=fengguang.wu@intel.com \
    --cc=gong.chen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liwanp@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox