All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@shadowen.org>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andy Whitcroft <apw@shadowen.org>, Mel Gorman <mel@csn.ul.ie>
Subject: [PATCH 3/5] lumpy: ensure that we compare PageActive and active safely
Date: Tue, 27 Feb 2007 11:35:23 -0800	[thread overview]
Message-ID: <e64dea44318a03a559d7a230d9b14e42@kernel> (raw)
In-Reply-To: exportbomb.1172604830@kernel


Now that we are passing in a boolean active flag we need to
ensure that the result of PageActive(page) is comparible
to that boolean.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
diff --git a/mm/vmscan.c b/mm/vmscan.c
index b878d54..2bfad79 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -632,7 +632,12 @@ static int __isolate_lru_page(struct page *page, int active)
 {
 	int ret = -EINVAL;
 
-	if (PageLRU(page) && (PageActive(page) == active)) {
+	/*
+	 * When checking the active state, we need to be sure we are
+	 * dealing with comparible boolean values.  Take the logical not
+	 * of each.
+	 */
+	if (PageLRU(page) && (!PageActive(page) == !active)) {
 		ret = -EBUSY;
 		if (likely(get_page_unless_zero(page))) {
 			/*

WARNING: multiple messages have this Message-ID (diff)
From: Andy Whitcroft <apw@shadowen.org>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andy Whitcroft <apw@shadowen.org>, Mel Gorman <mel@csn.ul.ie>
Subject: [PATCH 3/5] lumpy: ensure that we compare PageActive and active safely
Date: Tue, 27 Feb 2007 11:35:23 -0800	[thread overview]
Message-ID: <e64dea44318a03a559d7a230d9b14e42@kernel> (raw)
In-Reply-To: exportbomb.1172604830@kernel

Now that we are passing in a boolean active flag we need to
ensure that the result of PageActive(page) is comparible
to that boolean.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
diff --git a/mm/vmscan.c b/mm/vmscan.c
index b878d54..2bfad79 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -632,7 +632,12 @@ static int __isolate_lru_page(struct page *page, int active)
 {
 	int ret = -EINVAL;
 
-	if (PageLRU(page) && (PageActive(page) == active)) {
+	/*
+	 * When checking the active state, we need to be sure we are
+	 * dealing with comparible boolean values.  Take the logical not
+	 * of each.
+	 */
+	if (PageLRU(page) && (!PageActive(page) == !active)) {
 		ret = -EBUSY;
 		if (likely(get_page_unless_zero(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>

  parent reply	other threads:[~2007-02-27 19:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-27 19:33 [PATCH 0/5] Lumpy Reclaim V4 Andy Whitcroft
2007-02-27 19:33 ` Andy Whitcroft
2007-02-27 19:34 ` [PATCH 1/5] Lumpy Reclaim V3 Andy Whitcroft
2007-02-27 19:34   ` Andy Whitcroft
2007-02-28 18:14   ` Christoph Lameter
2007-02-28 18:14     ` Christoph Lameter
2007-03-02 15:45     ` Andy Whitcroft
2007-03-02 15:45       ` Andy Whitcroft
2007-02-27 19:34 ` [PATCH 2/5] lumpy: isolate_lru_pages wants to specifically take active or inactive pages Andy Whitcroft
2007-02-27 19:34   ` Andy Whitcroft
2007-02-28 18:17   ` Christoph Lameter
2007-02-28 18:17     ` Christoph Lameter
2007-03-02 15:57     ` Andy Whitcroft
2007-03-02 15:57       ` Andy Whitcroft
2007-02-27 19:35 ` Andy Whitcroft [this message]
2007-02-27 19:35   ` [PATCH 3/5] lumpy: ensure that we compare PageActive and active safely Andy Whitcroft
2007-02-27 19:35 ` [PATCH 4/5] lumpy: update commentry on subtle comparisons and rounding assumptions Andy Whitcroft
2007-02-27 19:35   ` Andy Whitcroft
2007-02-27 19:36 ` [PATCH 5/5] lumpy: only check for valid pages when holes are present Andy Whitcroft
2007-02-27 19:36   ` Andy Whitcroft

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=e64dea44318a03a559d7a230d9b14e42@kernel \
    --to=apw@shadowen.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    /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.