From 4504304ec5a818a3e9843b669c7bc6b5a4e548c5 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Tue, 17 Jul 2007 04:03:20 -0700 Subject: [PATCH] --- yaml --- r: 60731 b: refs/heads/master c: 68dff6a9af9f27df5aeee6d0339818b0e36c1b51 h: refs/heads/master i: 60729: 6bd1ab2c0e6f022645907451f38a2734b07dff45 60727: 640cd689e6784a0e716bde66863c029bd05baf0d v: v3 --- [refs] | 2 +- trunk/mm/slub.c | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/[refs] b/[refs] index 54ca20336132..aa490e50624c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5b95a4acf157eee552e013795b54eaa2ab1ee4a1 +refs/heads/master: 68dff6a9af9f27df5aeee6d0339818b0e36c1b51 diff --git a/trunk/mm/slub.c b/trunk/mm/slub.c index 3c9e98f0999a..a5832f82234c 100644 --- a/trunk/mm/slub.c +++ b/trunk/mm/slub.c @@ -2902,18 +2902,14 @@ static void free_loc_track(struct loc_track *t) get_order(sizeof(struct location) * t->max)); } -static int alloc_loc_track(struct loc_track *t, unsigned long max) +static int alloc_loc_track(struct loc_track *t, unsigned long max, gfp_t flags) { struct location *l; int order; - if (!max) - max = PAGE_SIZE / sizeof(struct location); - order = get_order(sizeof(struct location) * max); - l = (void *)__get_free_pages(GFP_ATOMIC, order); - + l = (void *)__get_free_pages(flags, order); if (!l) return 0; @@ -2979,7 +2975,7 @@ static int add_location(struct loc_track *t, struct kmem_cache *s, /* * Not found. Insert new tracking element. */ - if (t->count >= t->max && !alloc_loc_track(t, 2 * t->max)) + if (t->count >= t->max && !alloc_loc_track(t, 2 * t->max, GFP_ATOMIC)) return 0; l = t->loc + pos; @@ -3022,11 +3018,12 @@ static int list_locations(struct kmem_cache *s, char *buf, { int n = 0; unsigned long i; - struct loc_track t; + struct loc_track t = { 0, 0, NULL }; int node; - t.count = 0; - t.max = 0; + if (!alloc_loc_track(&t, PAGE_SIZE / sizeof(struct location), + GFP_KERNEL)) + return sprintf(buf, "Out of memory\n"); /* Push back cpu slabs */ flush_all(s);