Skip to contentSkip to conversation

__isolate_lru_page:skip unneeded "not"

PATCH Superseded Bob Liu 1 participant 2 messages Apr 1, 2010

Subsystems (3)
lore
Share & tools
lore

Bob Liu

author
#0 lore raw

PATCH 1/1 __isolate_lru_page:skip unneeded "not"

PageActive(page) will return int 0 or 1, mode is also int 0 or 1, they are comparible so "not" is unneeded to be sure to boolean values.
I also collected the ISOLATE_BOTH check together.

---
 mm/vmscan.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)
mm/vmscan.c +6 -11
index e0e5f15..46d1d52 100644
@@ -862,17 +862,11 @@ int __isolate_lru_page(struct page *page, int mode, int file)
 	if (!PageLRU(page))
 		return ret;
 
-	/*
-	 * When checking the active state, we need to be sure we are
-	 * dealing with comparible boolean values.  Take the logical not
-	 * of each.
-	 */
-	if (mode != ISOLATE_BOTH && (!PageActive(page) != !mode))
-		return ret;
-
-	if (mode != ISOLATE_BOTH && page_is_file_cache(page) != file)
-		return ret;
-
+	if (mode != ISOLATE_BOTH) {
+		if((PageActive(page) != mode) ||
+			(page_is_file_cache(page) != file))
+				return ret;
+	}
+
 	/*
 	 * When this function is being called for lumpy reclaim, we

* initially look into all LRU pages, active, inactive and

Signature · 7 lines
1.5.6.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#1 lore raw
Quoted 10 lines · Bob Liu

PageActive(page) will return int 0 or 1, mode is also int 0 or 1, they are comparible so "not" is unneeded to be sure to boolean values.
I also collected the ISOLATE_BOTH check together.

---
 mm/vmscan.c |   16 +++++-----------

 1 files changed, 5 insertions(+), 11 deletions(-)

There is a problem, and I have resent one.

Quoted 32 lines
mm/vmscan.c +6 -11
index e0e5f15..46d1d52 100644
@@ -862,17 +862,11 @@ int __isolate_lru_page(struct page *page, int mode, int file)
        if (!PageLRU(page))
                return ret;
 
-       /*
-        * When checking the active state, we need to be sure we are
-        * dealing with comparible boolean values.  Take the logical not
-        * of each.
-        */
-       if (mode != ISOLATE_BOTH && (!PageActive(page) != !mode))
-               return ret;
-
-       if (mode != ISOLATE_BOTH && page_is_file_cache(page) != file)
-               return ret;
-
+       if (mode != ISOLATE_BOTH) {
+               if((PageActive(page) != mode) ||
+                       (page_is_file_cache(page) != file))
+                               return ret;
+       }
+
        /*
         * When this function is being called for lumpy reclaim, we

        * initially look into all LRU pages, active, inactive and --
1.5.6.3

Signature · 8 lines
Regards,
--Bob

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>