linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Tony Luck <tony.luck@intel.com>,
	Andi Kleen <andi.kleen@intel.com>,
	Wu Fengguang <fengguang.wu@intel.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 3/3] HWPOISON, hugetlbfs: fix RSS-counter warning
Date: Thu, 6 Dec 2012 14:40:08 -0800	[thread overview]
Message-ID: <20121206144008.9b376ec7.akpm@linux-foundation.org> (raw)
In-Reply-To: <1354745673-31035-1-git-send-email-n-horiguchi@ah.jp.nec.com>

On Wed,  5 Dec 2012 17:14:33 -0500
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> wrote:

> Hi Tony,
> 
> On Wed, Dec 05, 2012 at 10:04:50PM +0000, Luck, Tony wrote:
> > 	if (PageHWPoison(page) && !(flags & TTU_IGNORE_HWPOISON)) {
> > -		if (PageAnon(page))
> > +		if (PageHuge(page))
> > +			;
> > +		else if (PageAnon(page))
> >  			dec_mm_counter(mm, MM_ANONPAGES);
> >  		else
> >  			dec_mm_counter(mm, MM_FILEPAGES);
> > 
> > This style minimizes the "diff" ... but wouldn't it be nicer to say:
> > 
> > 		if (!PageHuge(page)) {
> > 			old code in here
> > 		}
> > 
> 
> I think this need more lines in diff because old code should be
> indented without any logical change.

I do agree with Tony on this.  While it is nice to keep the diff
looking simple, it is more important that the resulting code be clean
and idiomatic.

--- a/mm/rmap.c~hwpoison-hugetlbfs-fix-rss-counter-warning-fix
+++ a/mm/rmap.c
@@ -1249,14 +1249,14 @@ int try_to_unmap_one(struct page *page, 
 	update_hiwater_rss(mm);
 
 	if (PageHWPoison(page) && !(flags & TTU_IGNORE_HWPOISON)) {
-		if (PageHuge(page))
-			;
-		else if (PageAnon(page))
-			dec_mm_counter(mm, MM_ANONPAGES);
-		else
-			dec_mm_counter(mm, MM_FILEPAGES);
-		set_pte_at(mm, address, pte,
-				swp_entry_to_pte(make_hwpoison_entry(page)));
+		if (!PageHuge(page)) {
+			if (PageAnon(page))
+				dec_mm_counter(mm, MM_ANONPAGES);
+			else
+				dec_mm_counter(mm, MM_FILEPAGES);
+			set_pte_at(mm, address, pte,
+				   swp_entry_to_pte(make_hwpoison_entry(page)));
+		}
 	} else if (PageAnon(page)) {
 		swp_entry_t entry = { .val = page_private(page) };
 
_

--
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:[~2012-12-06 22:40 UTC|newest]

Thread overview: 22+ 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 ` [PATCH 1/3] HWPOISON, hugetlbfs: fix warning on freeing hwpoisoned hugepage Naoya Horiguchi
2012-12-05 22:13   ` Luck, Tony
2012-12-07  2:18     ` Naoya Horiguchi
2012-12-06 22:36   ` Andrew Morton
2012-12-07  2:03     ` Naoya Horiguchi
2012-12-07  2:20       ` Andrew Morton
2012-12-07  5:48         ` Naoya Horiguchi
2012-12-07  5:36       ` Aneesh Kumar K.V
2012-12-07  6:14         ` Naoya Horiguchi
2012-12-07  7:54           ` Aneesh Kumar K.V
2012-12-07 15:49             ` Naoya Horiguchi
2012-12-07 22:34               ` Andrew Morton
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 ` [PATCH 3/3] HWPOISON, hugetlbfs: fix RSS-counter warning Naoya Horiguchi
2012-12-05 22:04   ` Luck, Tony
2012-12-05 22:14     ` Naoya Horiguchi
2012-12-06 22:40       ` Andrew Morton [this message]
2012-12-07  1:22         ` Naoya Horiguchi
2012-12-07  2:10           ` Andrew Morton
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=20121206144008.9b376ec7.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 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).