__isolate_lru_page:skip unneeded "not"
Subsystems (3)
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.
Signed-off-by Bob Liu <[email protected]>
--- mm/vmscan.c | 16 +++++----------- 1 files changed, 5 insertions(+), 11 deletions(-)
mm/vmscan.c +6 -11
@@ -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>
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 theISOLATE_BOTHcheck together.Signed-off-by Bob Liu <[email protected]>---
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@@ -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>