* [PATCH] - Allocate larger cache_cache if order 0 fails
@ 2006-03-07 15:48 Jack Steiner
2006-03-07 19:36 ` Pekka Enberg
0 siblings, 1 reply; 4+ messages in thread
From: Jack Steiner @ 2006-03-07 15:48 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
kmem_cache_init() incorrectly assumes that the cache_cache object will
fit in an order 0 allocation. On very large systems, this is not
true. Change the code to try larger order allocations if order 0 fails.
Signed-off-by: Jack Steiner <steiner@sgi.com>
Index: linux/mm/slab.c
===================================================================
--- linux.orig/mm/slab.c 2006-03-01 16:07:31.000000000 -0600
+++ linux/mm/slab.c 2006-03-03 13:21:52.000000000 -0600
@@ -1124,6 +1124,7 @@ void __init kmem_cache_init(void)
struct cache_sizes *sizes;
struct cache_names *names;
int i;
+ int order;
for (i = 0; i < NUM_INIT_LISTS; i++) {
kmem_list3_init(&initkmem_list3[i]);
@@ -1167,11 +1168,15 @@ void __init kmem_cache_init(void)
cache_cache.buffer_size = ALIGN(cache_cache.buffer_size, cache_line_size());
- cache_estimate(0, cache_cache.buffer_size, cache_line_size(), 0,
- &left_over, &cache_cache.num);
+ for (order = 0; order < MAX_ORDER; order++) {
+ cache_estimate(order, cache_cache.buffer_size, cache_line_size(), 0,
+ &left_over, &cache_cache.num);
+ if (cache_cache.num)
+ break;
+ }
if (!cache_cache.num)
BUG();
-
+ cache_cache.gfporder = order;
cache_cache.colour = left_over / cache_cache.colour_off;
cache_cache.slab_size = ALIGN(cache_cache.num * sizeof(kmem_bufctl_t) +
sizeof(struct slab), cache_line_size());
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] - Allocate larger cache_cache if order 0 fails
2006-03-07 15:48 [PATCH] - Allocate larger cache_cache if order 0 fails Jack Steiner
@ 2006-03-07 19:36 ` Pekka Enberg
2006-03-07 20:58 ` Jack Steiner
0 siblings, 1 reply; 4+ messages in thread
From: Pekka Enberg @ 2006-03-07 19:36 UTC (permalink / raw)
To: Jack Steiner; +Cc: akpm, linux-kernel
Hi Jack,
On 3/7/06, Jack Steiner <steiner@sgi.com> wrote:
> - cache_estimate(0, cache_cache.buffer_size, cache_line_size(), 0,
> - &left_over, &cache_cache.num);
> + for (order = 0; order < MAX_ORDER; order++) {
> + cache_estimate(order, cache_cache.buffer_size, cache_line_size(), 0,
> + &left_over, &cache_cache.num);
> + if (cache_cache.num)
> + break;
> + }
Any reason why you can't use calculate_slab_order() here?
Pekka
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] - Allocate larger cache_cache if order 0 fails
2006-03-07 19:36 ` Pekka Enberg
@ 2006-03-07 20:58 ` Jack Steiner
2006-03-08 7:10 ` Pekka J Enberg
0 siblings, 1 reply; 4+ messages in thread
From: Jack Steiner @ 2006-03-07 20:58 UTC (permalink / raw)
To: Pekka Enberg; +Cc: akpm, linux-kernel
On Tue, Mar 07, 2006 at 09:36:04PM +0200, Pekka Enberg wrote:
> Hi Jack,
>
> On 3/7/06, Jack Steiner <steiner@sgi.com> wrote:
> > - cache_estimate(0, cache_cache.buffer_size, cache_line_size(), 0,
> > - &left_over, &cache_cache.num);
> > + for (order = 0; order < MAX_ORDER; order++) {
> > + cache_estimate(order, cache_cache.buffer_size, cache_line_size(), 0,
> > + &left_over, &cache_cache.num);
> > + if (cache_cache.num)
> > + break;
> > + }
>
> Any reason why you can't use calculate_slab_order() here?
>
> Pekka
I think either will work & the amount of code is about the same.
I chose the above because it was easier to see that change had no effect
on existing platforms.
Does anyone see a compelling reason for a different but equivalent implementation??
---
Jack
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-03-08 7:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-07 15:48 [PATCH] - Allocate larger cache_cache if order 0 fails Jack Steiner
2006-03-07 19:36 ` Pekka Enberg
2006-03-07 20:58 ` Jack Steiner
2006-03-08 7:10 ` Pekka J Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox