Skip to contentSkip to conversation

__isolate_lru_page: skip unneeded mode check

PATCH In review Bob Liu 2 participants 5 messages Mar 31, 2010 – Apr 1, 2010

Subsystems (3)
lore
Share & tools
lore

Bob Liu

author
#0 lore raw

PATCH 1/1 __isolate_lru_page: skip unneeded mode check

From: Bob Liu <[email protected]>

Whether mode is ISOLATE_BOTH or not, we should compare page_is_file_cache with argument file.

And there is no more need not when checking the active state.

---
 mm/vmscan.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
mm/vmscan.c +2 -7
index e0e5f15..34d7e3d 100644
@@ -862,15 +862,10 @@ 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))
+	if (mode != ISOLATE_BOTH && (PageActive(page) != mode))
 		return ret;
 
-	if (mode != ISOLATE_BOTH && page_is_file_cache(page) != file)
+	if (page_is_file_cache(page) != file)
 		return ret;
 
 	/*
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>
#1 lore raw

2010/3/31 Bob Liu <[email protected]>:

Quoted 18 lines

From: Bob Liu <[email protected]>

Whether mode is ISOLATE_BOTH or not, we should compare page_is_file_cache with argument file.

And there is no more need not when checking the active state.

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

 1 files changed, 2 insertions(+), 7 deletions(-)
mm/vmscan.c +0 -0
index e0e5f15..34d7e3d 100644
@@ -862,15 +862,10 @@ int __isolate_lru_page(struct page *page, int mode, int file)
        if (!PageLRU(page))

mm/vmscan.c int __isolate_lru_page(struct page *page, int mode, int file) · line 866

Quoted 10 lines
mm/vmscan.c +1 -6
                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))
+       if (mode != ISOLATE_BOTH && (PageActive(page) != mode))
                return ret;

no. please read the comment.

mm/vmscan.c int __isolate_lru_page(struct page *page, int mode, int file) · line 869

Quoted 3 lines
mm/vmscan.c +1 -1
-       if (mode != ISOLATE_BOTH && page_is_file_cache(page) != file)
+       if (page_is_file_cache(page) != file)
                return ret;

no. please consider lumpy reclaim.

--
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
#2 lore raw
Quoted 22 lines · KOSAKI Motohiro

2010/3/31 Bob Liu <[email protected]>:

Quoted 21 lines

From: Bob Liu <[email protected]>

Whether mode is ISOLATE_BOTH or not, we should compare page_is_file_cache with argument file.

And there is no more need not when checking the active state.

---
 mm/vmscan.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
mm/vmscan.c +0 -0
index e0e5f15..34d7e3d 100644
@@ -862,15 +862,10 @@ int __isolate_lru_page(struct page *page, int mode,
 int file)
       if (!PageLRU(page))
               return ret;
 
Quoted 11 lines

mm/vmscan.c int __isolate_lru_page(struct page *page, int mode, int file) · line 866

Quoted 8 lines
mm/vmscan.c +1 -6
-       /*
-        * 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))
+       if (mode != ISOLATE_BOTH && (PageActive(page) != mode))
               return ret;

no. please read the comment.

Hm,. I have read it, but still miss it :-). PageActive(page) will return an int 0 or 1, mode is also int 0 or 1( already != ISOLATE_BOTH).
There are comparible and why must to be sure to boolean values?

Quoted 6 lines

mm/vmscan.c int __isolate_lru_page(struct page *page, int mode, int file) · line 869

Quoted 3 lines
mm/vmscan.c +1 -1
-       if (mode != ISOLATE_BOTH && page_is_file_cache(page) != file)
+       if (page_is_file_cache(page) != file)
               return ret;

no. please consider lumpy reclaim.

During lumpy reclaim mode is ISOLATE_BOTH, that case we don't check page_is_file_cache() ? Would you please explain it a little more ,i am still unclear about it.
Thanks a lot.

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>
#3 lore raw
Quoted 17 lines
Quoted 5 lines
Quoted 5 lines
mm/vmscan.c +0 -0
@@ -862,15 +862,10 @@ int __isolate_lru_page(struct page *page, int mode,
 int file)
       if (!PageLRU(page))
               return ret;
 
Quoted 11 lines

mm/vmscan.c int __isolate_lru_page(struct page *page, int mode, int file) · line 866

Quoted 8 lines
mm/vmscan.c +1 -6
-       /*
-        * 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))
+       if (mode != ISOLATE_BOTH && (PageActive(page) != mode))
               return ret;

no. please read the comment.

Quoted 4 lines

Hm,. I have read it, but still miss it :-). PageActive(page) will return an int 0 or 1, mode is also int 0 or 1( already != ISOLATE_BOTH).
There are comparible and why must to be sure to boolean values?

hm, ok. you are right.
please resend this part as individual patch.

Quoted 10 lines
Quoted 5 lines

mm/vmscan.c int __isolate_lru_page(struct page *page, int mode, int file) · line 869

Quoted 3 lines
mm/vmscan.c +1 -1
-       if (mode != ISOLATE_BOTH && page_is_file_cache(page) != file)
+       if (page_is_file_cache(page) != file)
               return ret;

no. please consider lumpy reclaim.

During lumpy reclaim mode is ISOLATE_BOTH, that case we don't check page_is_file_cache() ? Would you please explain it a little more ,i am still unclear about it.
Thanks a lot.

ISOLATE_BOTH is for to help allocate high order memory. then, it ignore both PageActive() and page_is_file_cache(). otherwise, we fail to allocate high order memory.

--
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
#4 lore raw
Quoted 17 lines · KOSAKI Motohiro
Quoted 17 lines
Quoted 16 lines

mm/vmscan.c int __isolate_lru_page(struct page *page, int mode, · line 867

Quoted 13 lines
mm/vmscan.c +1 -6
@@ -862,15 +862,10 @@ 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))
+       if (mode != ISOLATE_BOTH && (PageActive(page) != mode))
                return ret;

no. please read the comment.

Quoted 8 lines
Quoted 4 lines

Hm,. I have read it, but still miss it :-). PageActive(page) will return an int 0 or 1, mode is also int 0 or 1( already != ISOLATE_BOTH).
There are comparible and why must to be sure to boolean values?

hm, ok. you are right.
please resend this part as individual patch.

I have resent this part :-).

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

mm/vmscan.c int __isolate_lru_page(struct page *page, int mode, int file) · line 869

Quoted 4 lines
mm/vmscan.c +1 -1
-       if (mode != ISOLATE_BOTH && page_is_file_cache(page) != file)
+       if (page_is_file_cache(page) != file)
                return ret;

no. please consider lumpy reclaim.

Quoted 9 lines
Quoted 4 lines

During lumpy reclaim mode is ISOLATE_BOTH, that case we don't check page_is_file_cache() ?  Would you please explain it a little more ,i am still unclear about it.
Thanks a lot.

ISOLATE_BOTH is for to help allocate high order memory. then, it ignore both PageActive() and page_is_file_cache(). otherwise, we fail to allocate high order memory.

I got it, thanks.
And I have resent a patch collected ISOLATE_BOTH check.

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>