Re: [PATCH] shrink_list: Use of && instead || leads to unintendedwriting of pages

From: Andrew Morton
Date: Thu Jan 19 2006 - 19:41:13 EST


Christoph Lameter <clameter@xxxxxxxxxxxx> wrote:
>
> The check for laptop mode and sc->may_writepage is intended to not write
> pages if either laptop mode is set or we are not allowed to write.
>
> The && there means that currently pages may be written in laptop mode and during
> zone_reclaim. This patch also applies to 2.6.15 and 2.6.14!
>
> Signed-off-by: Christoph Lameter <clameter@xxxxxxx>
>
> Index: linux-2.6.16-rc1-mm1/mm/vmscan.c
> ===================================================================
> --- linux-2.6.16-rc1-mm1.orig/mm/vmscan.c 2006-01-19 15:40:28.000000000 -0800
> +++ linux-2.6.16-rc1-mm1/mm/vmscan.c 2006-01-19 15:40:30.000000000 -0800
> @@ -491,7 +491,7 @@ static int shrink_list(struct list_head
> goto keep_locked;
> if (!may_enter_fs)
> goto keep_locked;
> - if (laptop_mode && !sc->may_writepage)
> + if (laptop_mode || !sc->may_writepage)
> goto keep_locked;
>
> /* Page is dirty, try to write it out here */

erk.

The effects of this fix will be a) slightly improved memory allocator
latency, b) somehat improved disk writeout patterns and c) somewhat
increased risk of ooms.

So we'll need to sit on it for quite some time to let it settle in, thanks.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/