linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] __isolate_lru_page:skip unneeded "not"
@ 2010-04-01 13:24 Bob Liu
  2010-04-01 13:37 ` Bob Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Bob Liu @ 2010-04-01 13:24 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, kosaki.motohiro, 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.

Signed-off-by: Bob Liu <lliubbo@gmail.com>
---
 mm/vmscan.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index e0e5f15..46d1d52 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -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

--
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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] __isolate_lru_page:skip unneeded "not"
  2010-04-01 13:24 [PATCH] __isolate_lru_page:skip unneeded "not" Bob Liu
@ 2010-04-01 13:37 ` Bob Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Bob Liu @ 2010-04-01 13:37 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, kosaki.motohiro, Bob Liu

On Thu, Apr 1, 2010 at 9:24 PM, Bob Liu <lliubbo@gmail.com> wrote:
> 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 <lliubbo@gmail.com>
> ---
>  mm/vmscan.c |   16 +++++-----------
>  1 files changed, 5 insertions(+), 11 deletions(-)
>

There is a problem, and I have resent one.

> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index e0e5f15..46d1d52 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -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
>
>



-- 
Regards,
--Bob

--
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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-01 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-01 13:24 [PATCH] __isolate_lru_page:skip unneeded "not" Bob Liu
2010-04-01 13:37 ` Bob Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox