2005-09-26 20:14:46

by Joel Schopp

[permalink] [raw]
Subject: [PATCH 7/9] try harder on large allocations

Index: 2.6.13-joel2/mm/page_alloc.c
===================================================================
--- 2.6.13-joel2.orig/mm/page_alloc.c 2005-09-21 11:13:14.%N -0500
+++ 2.6.13-joel2/mm/page_alloc.c 2005-09-21 11:14:49.%N -0500
@@ -944,7 +944,8 @@ __alloc_pages(unsigned int __nocast gfp_
int can_try_harder;
int did_some_progress;
int alloctype;
-
+ int highorder_retry = 3;
+
alloctype = (gfp_mask & __GFP_RCLM_BITS);
might_sleep_if(wait);

@@ -1090,7 +1091,14 @@ rebalance:
goto got_pg;
}

- out_of_memory(gfp_mask, order);
+ if (order < MAX_ORDER/2) out_of_memory(gfp_mask, order);
+ /*
+ * Due to low fragmentation efforts, we should try a little
+ * harder to satisfy high order allocations
+ */
+ if (order >= MAX_ORDER/2 && --highorder_retry > 0)
+ goto rebalance;
+
goto restart;
}

@@ -1107,6 +1115,8 @@ rebalance:
do_retry = 1;
if (gfp_mask & __GFP_NOFAIL)
do_retry = 1;
+ if (order >= MAX_ORDER/2 && --highorder_retry > 0)
+ do_retry = 1;
}
if (do_retry) {
blk_congestion_wait(WRITE, HZ/50);


Attachments:
7_large_alloc_try_harder (1.04 kB)

2005-09-27 07:21:06

by Coywolf Qi Hunt

[permalink] [raw]
Subject: Re: [PATCH 7/9] try harder on large allocations

On 9/27/05, Joel Schopp <[email protected]> wrote:
> Fragmentation avoidance patches increase our chances of satisfying high order
> allocations. So this patch takes more than one iteration at trying to fulfill
> those allocations because unlike before the extra iterations are often useful.
>
> Signed-off-by: Mel Gorman <[email protected]>
> Signed-off-by: Joel Schopp <[email protected]>
>
>
> Index: 2.6.13-joel2/mm/page_alloc.c
> ===================================================================
> --- 2.6.13-joel2.orig/mm/page_alloc.c 2005-09-21 11:13:14.%N -0500
> +++ 2.6.13-joel2/mm/page_alloc.c 2005-09-21 11:14:49.%N -0500
> @@ -944,7 +944,8 @@ __alloc_pages(unsigned int __nocast gfp_
> int can_try_harder;
> int did_some_progress;
> int alloctype;
> -
> + int highorder_retry = 3;
> +
> alloctype = (gfp_mask & __GFP_RCLM_BITS);
> might_sleep_if(wait);
>
> @@ -1090,7 +1091,14 @@ rebalance:
> goto got_pg;
> }
>
> - out_of_memory(gfp_mask, order);
> + if (order < MAX_ORDER/2) out_of_memory(gfp_mask, order);

Shouldn't that be written in two lines?

> + /*
> + * Due to low fragmentation efforts, we should try a little
> + * harder to satisfy high order allocations
> + */
> + if (order >= MAX_ORDER/2 && --highorder_retry > 0)
> + goto rebalance;
> +
> goto restart;
> }

--
Coywolf Qi Hunt
http://sosdg.org/~coywolf/

2005-09-27 16:17:51

by Joel Schopp

[permalink] [raw]
Subject: Re: [PATCH 7/9] try harder on large allocations

>>+ if (order < MAX_ORDER/2) out_of_memory(gfp_mask, order);
>
>
> Shouldn't that be written in two lines?

Yes, fixed.