Re: [PATCH]vmscan: handle underflow for get_scan_ratio

KOSAKI Motohiro
2010-04-15T03:25:47Z

Hi

sorry for the delay.

> > After solving streaming io issue, I'll put it to mainline.
> if the streaming io issue is popular, how about below patch against my last one?
> we take priority == DEF_PRIORITY an exception.

Your patch seems works. but it is obviously ugly and bandaid patch.
So, I like single your previous patch rather than combinate this one.
Even though both dropping makes sense rather than both merge.

Please consider attack root cause.

> Index: linux/mm/vmscan.c
> ===================================================================
> --- linux.orig/mm/vmscan.c 2010-04-14 09:03:28.000000000 +0800
> +++ linux/mm/vmscan.c 2010-04-14 09:19:56.000000000 +0800
> @@ -1629,6 +1629,22 @@ static void get_scan_count(struct zone *
> fraction[0] = ap;
> fraction[1] = fp;
> denominator = ap + fp + 1;
> +
> + /*
> + * memory pressure isn't high, we allow percentage underflow. This
> + * avoids swap in stream io case.
> + */
> + if (priority == DEF_PRIORITY) {
> + if (fraction[0] * 99 < fraction[1]) {
> + fraction[0] = 0;
> + fraction[1] = 1;
> + denominator = 1;
> + } else if (fraction[1] * 99 < fraction[0]) {
> + fraction[0] = 1;
> + fraction[1] = 0;
> + denominator = 1;
> + }
> + }
> out:
> for_each_evictable_lru(l) {
> int file = is_file_lru(l);
>
> --
> 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: email@kvack.org