diff options
author | Andrew Morton <akpm@osdl.org> | 2004-08-23 21:25:56 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-08-23 21:25:56 -0700 |
commit | 29d15009ea0163a65b3f46a71d2f16d4150cfc98 (patch) | |
tree | e1a75a1bac9e79b7f8fe1f5b62e088f7842bfc75 /mm | |
parent | ac12db05e3093de2624d842dc2677621f49d0d74 (diff) | |
download | history-29d15009ea0163a65b3f46a71d2f16d4150cfc98.tar.gz |
[PATCH] alloc_pages priority tuning
Fix up the logic which decides when the caller can dip into page reserves.
- If the caller has realtime scheduling policy, or if the caller cannot run
direct reclaim, then allow the caller to use up to a quarter of the page
reserves.
- If the caller has __GFP_HIGH then allow the caller to use up to half of
the page reserves.
- If the caller has PF_MEMALLOC then the caller can use 100% of the page
reserves.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/page_alloc.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index bfb2e077e5be9d..050f5a41c37dc1 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -607,9 +607,17 @@ __alloc_pages(unsigned int gfp_mask, unsigned int order, int i; int alloc_type; int do_retry; + int can_try_harder; might_sleep_if(wait); + /* + * The caller may dip into page reserves a bit more if the caller + * cannot run direct reclaim, or is the caller has realtime scheduling + * policy + */ + can_try_harder = (unlikely(rt_task(p)) && !in_interrupt()) || !wait; + zones = zonelist->zones; /* the list of zones suitable for gfp_mask */ if (unlikely(zones[0] == NULL)) { @@ -641,9 +649,9 @@ __alloc_pages(unsigned int gfp_mask, unsigned int order, for (i = 0; (z = zones[i]) != NULL; i++) { min = z->pages_min; if (gfp_mask & __GFP_HIGH) - min -= min>>1; - if (unlikely(rt_task(p)) && !in_interrupt()) - min -= min>>2; + min /= 2; + if (can_try_harder) + min -= min / 4; min += (1<<order) + z->protection[alloc_type]; if (z->free_pages < min) @@ -684,9 +692,9 @@ rebalance: for (i = 0; (z = zones[i]) != NULL; i++) { min = z->pages_min; if (gfp_mask & __GFP_HIGH) - min -= min>>1; - if (unlikely(rt_task(p)) && !in_interrupt()) - min -= min>>2; + min /= 2; + if (can_try_harder) + min -= min / 4; min += (1<<order) + z->protection[alloc_type]; if (z->free_pages < min) |