linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Andi Kleen <andi@firstfloor.org>,
	Wu Fengguang <fengguang.wu@intel.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm/memory-failure.c: fix memory leak by race between poison and unpoison
Date: Wed, 14 May 2014 19:49:41 -0400	[thread overview]
Message-ID: <5374012a.c1d80e0a.2cba.4e77SMTPIN_ADDED_BROKEN@mx.google.com> (raw)
In-Reply-To: <20140514151037.37592c3bb31f51fdad8c5a42@linux-foundation.org>

On Wed, May 14, 2014 at 03:10:37PM -0700, Andrew Morton wrote:
...
> Looking at the surrounding code...
> 
> 	/*
> 	 * Lock the page and wait for writeback to finish.
> 	 * It's very difficult to mess with pages currently under IO
> 	 * and in many cases impossible, so we just avoid it here.
> 	 */
> 	lock_page(hpage);
> 
> 
> lock_page() doesn't wait for writeback to finish -
> wait_on_page_writeback() does that.  Either the code or the comment
> could do with fixing.

OK, here is the patch to move the comment.

---
Subject: [PATCH] mm/memory-failure.c: move comment

The comment about pages under writeback is far from the relevant code,
so let's move it to the right place.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
 mm/memory-failure.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 93a08bd78c78..e3154d99b87f 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1132,11 +1132,6 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
 		}
 	}
 
-	/*
-	 * Lock the page and wait for writeback to finish.
-	 * It's very difficult to mess with pages currently under IO
-	 * and in many cases impossible, so we just avoid it here.
-	 */
 	lock_page(hpage);
 
 	/*
@@ -1186,6 +1181,10 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
 	if (PageHuge(p))
 		set_page_hwpoison_huge_page(hpage);
 
+	/*
+	 * It's very difficult to mess with pages currently under IO
+	 * and in many cases impossible, so we just avoid it here.
+	 */
 	wait_on_page_writeback(p);
 
 	/*
-- 
1.9.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>

  reply	other threads:[~2014-05-14 23:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 15:21 Naoya Horiguchi
2014-05-14 22:10 ` Andrew Morton
2014-05-14 23:49   ` Naoya Horiguchi [this message]
2014-05-15  3:34 ` cyc
2014-05-15 12:23   ` Naoya Horiguchi
2014-05-15 14:13     ` 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=5374012a.c1d80e0a.2cba.4e77SMTPIN_ADDED_BROKEN@mx.google.com \
    --to=n-horiguchi@ah.jp.nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=fengguang.wu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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