From: Christoph Lameter <clameter@sgi.com>
To: Nick Piggin <npiggin@suse.de>
Cc: Matt Mackall <mpm@selenic.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [patch 1/3] slob: rework freelist handling
Date: Wed, 23 May 2007 11:04:28 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0705231102530.20395@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20070523074636.GA10070@wotan.suse.de>
Could you try this patch and tell me how much memory it saves?
SLUB embedded: Reduce memory use
If we do not have CONFIG_SLUB_DEBUG set then assume that we need
to conserve memory. So
1. Reduce size of kmem_cache_node
2. Do not keep empty partial slabs around
3. Remove all empty cpu slabs when bootstrap of the kernel
is complete. New cpu slabs will only be added for
the slabs actually used by user space.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
include/linux/slub_def.h | 2 ++
mm/slub.c | 14 ++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
Index: slub/include/linux/slub_def.h
===================================================================
--- slub.orig/include/linux/slub_def.h 2007-05-22 22:46:06.000000000 -0700
+++ slub/include/linux/slub_def.h 2007-05-22 23:31:18.000000000 -0700
@@ -17,7 +17,9 @@ struct kmem_cache_node {
unsigned long nr_partial;
atomic_long_t nr_slabs;
struct list_head partial;
+#ifdef CONFIG_SLUB_DEBUG
struct list_head full;
+#endif
};
/*
Index: slub/mm/slub.c
===================================================================
--- slub.orig/mm/slub.c 2007-05-22 22:46:06.000000000 -0700
+++ slub/mm/slub.c 2007-05-23 10:32:36.000000000 -0700
@@ -183,7 +183,11 @@ static inline void ClearSlabDebug(struct
* Mininum number of partial slabs. These will be left on the partial
* lists even if they are empty. kmem_cache_shrink may reclaim them.
*/
+#ifdef CONFIG_SLUB_DEBUG
+#define MIN_PARTIAL 2
+#else
#define MIN_PARTIAL 0
+#endif
/*
* Maximum number of desirable partial slabs.
@@ -1792,7 +1796,9 @@ static void init_kmem_cache_node(struct
atomic_long_set(&n->nr_slabs, 0);
spin_lock_init(&n->list_lock);
INIT_LIST_HEAD(&n->partial);
+#ifdef CONFIG_SLUB_DEBUG
INIT_LIST_HEAD(&n->full);
+#endif
}
#ifdef CONFIG_NUMA
@@ -3659,17 +3665,20 @@ static int sysfs_slab_alias(struct kmem_
return 0;
}
+#endif
static int __init slab_sysfs_init(void)
{
struct list_head *h;
int err;
+#ifdef CONFIG_SLUB_DEBUG
err = subsystem_register(&slab_subsys);
if (err) {
printk(KERN_ERR "Cannot register slab subsystem.\n");
return -ENOSYS;
}
+#endif
slab_state = SYSFS;
list_for_each(h, &slab_caches) {
@@ -3678,8 +3687,10 @@ static int __init slab_sysfs_init(void)
err = sysfs_slab_add(s);
BUG_ON(err);
+ kmem_cache_shrink(s);
}
+#ifdef CONFIG_SLUB_DEBUG
while (alias_list) {
struct saved_alias *al = alias_list;
@@ -3690,8 +3701,7 @@ static int __init slab_sysfs_init(void)
}
resiliency_test();
+#endif
return 0;
}
-
__initcall(slab_sysfs_init);
-#endif
--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2007-05-23 18:04 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-22 7:39 Nick Piggin
2007-05-22 7:39 ` [patch 2/3] slob: remove bigblock tracking Nick Piggin
2007-05-22 7:41 ` [patch 3/3] slob: improved alignment handling Nick Piggin
2007-05-22 14:53 ` [patch 1/3] slob: rework freelist handling Matt Mackall
2007-05-22 19:18 ` Christoph Lameter
2007-05-23 3:06 ` Nick Piggin
2007-05-23 4:55 ` Christoph Lameter
2007-05-23 4:59 ` Nick Piggin
2007-05-23 5:01 ` Christoph Lameter
2007-05-23 5:03 ` Nick Piggin
2007-05-23 5:06 ` Christoph Lameter
2007-05-23 5:11 ` Nick Piggin
2007-05-23 5:14 ` Christoph Lameter
2007-05-23 5:22 ` Nick Piggin
2007-05-23 5:28 ` Christoph Lameter
2007-05-23 6:17 ` Nick Piggin
2007-05-23 6:28 ` Christoph Lameter
2007-05-23 7:12 ` Nick Piggin
2007-05-23 17:03 ` Christoph Lameter
2007-05-23 18:32 ` Matt Mackall
2007-05-23 19:15 ` Christoph Lameter
2007-05-23 19:58 ` Matt Mackall
2007-05-23 20:02 ` Christoph Lameter
2007-05-23 20:16 ` Christoph Lameter
2007-05-23 21:14 ` Matt Mackall
2007-05-23 21:06 ` Matt Mackall
2007-05-23 22:26 ` Christoph Lameter
2007-05-23 22:42 ` Matt Mackall
2007-05-23 22:48 ` Christoph Lameter
2007-05-24 2:05 ` Nick Piggin
2007-05-24 2:45 ` Christoph Lameter
2007-05-24 2:47 ` Nick Piggin
2007-05-24 2:55 ` Christoph Lameter
2007-05-24 3:17 ` Nick Piggin
2007-05-24 2:49 ` Christoph Lameter
2007-05-24 3:15 ` Nick Piggin
2007-05-24 3:51 ` Christoph Lameter
2007-05-24 6:11 ` Matt Mackall
2007-05-24 16:36 ` Christoph Lameter
2007-05-24 17:22 ` Matt Mackall
2007-05-24 17:27 ` Christoph Lameter
2007-05-24 17:44 ` Matt Mackall
2007-05-23 6:38 ` Christoph Lameter
2007-05-23 7:18 ` Nick Piggin
2007-05-23 17:06 ` Christoph Lameter
2007-05-23 7:46 ` Nick Piggin
2007-05-23 17:07 ` Christoph Lameter
2007-05-23 19:35 ` Matt Mackall
2007-05-23 19:59 ` Christoph Lameter
2007-05-23 20:51 ` Matt Mackall
2007-05-24 3:39 ` Nick Piggin
2007-05-24 3:55 ` Christoph Lameter
2007-05-24 4:13 ` Nick Piggin
2007-05-24 4:23 ` Christoph Lameter
2007-05-24 4:31 ` Nick Piggin
2007-05-24 4:35 ` Christoph Lameter
2007-05-24 4:39 ` Nick Piggin
2007-05-24 4:46 ` Christoph Lameter
2007-05-24 4:49 ` Nick Piggin
2007-05-24 5:07 ` Christoph Lameter
2007-05-24 3:24 ` Nick Piggin
2007-05-24 3:49 ` Christoph Lameter
2007-05-24 4:01 ` Nick Piggin
2007-05-24 4:05 ` Christoph Lameter
2007-05-24 4:24 ` Nick Piggin
2007-05-23 18:04 ` Christoph Lameter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0705231102530.20395@schroedinger.engr.sgi.com \
--to=clameter@sgi.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=mpm@selenic.com \
--cc=npiggin@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox