linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Major regression on hackbench with SLUB
@ 2007-12-07 17:50 Steven Rostedt
  2007-12-07 17:55 ` Ingo Molnar
                   ` (2 more replies)
  0 siblings, 3 replies; 94+ messages in thread
From: Steven Rostedt @ 2007-12-07 17:50 UTC (permalink / raw)
  To: LKML
  Cc: Christoph Lameter, Ingo Molnar, Linus Torvalds, Peter Zijlstra,
	Christoph Hellwig

Hi,

I've been doing some benchmarks for RT task migrations and I stumbled
over this regression. I first thought it was a regression with CFS and
started doing a git bisect. But I later found that the "good" kernel
also failed. Then I started looking at the config options and discovered
that SLUB has become the default.

When I put SLAB back, the regression went away, even on the lastest git
tree.

So I ran the hackbench benchmarks with the latest git commit
(f194d132e4971111f85c18c96067acffb13cee6d at the time of this writing).
And put up the results on my web page.

http://people.redhat.com/srostedt/slab/

I ran Ingo's cfs-debug-info.sh and have the results of that on the web
page. That script records lots of good information to see what kind of
machine I ran this on. This is a 64way box (yes lots of CPUS!).

The hackbench code and the script I used to run and record the results
is also present. I ran "hackbench 90" 20 times, 10 times as SCHED_OTHER
and 10 times as SCHED_FIFO (chrt -f 10 hackbench 90).  The graph shows
both runs (min, max and average). The versions that start with
"rt:" (although the graph somehow truncated it to just "t:") are the
SCHED_FIFO runs. (click on the graph to see a bigger version)

The regression is that hackbench slows down tremendously. It goes from
running just under 2 seconds to running around 14 seconds.

Hackbench seems to show this regression the most. In my tests I didn't
see much change with kernel builds and such, but the focus was on
scheduling not memory management. I'll run my kernel tests next for both
SLAB and SLUB and see if there's any difference there.

But this regression might be a reason to not have SLUB as default for
now. At least until we find out why this is affected so badly.

-- Steve



^ permalink raw reply	[flat|nested] 94+ messages in thread
* [PATCH] slub: provide /proc/slabinfo
@ 2008-01-07 12:28 Pekka J Enberg
  0 siblings, 0 replies; 94+ messages in thread
From: Pekka J Enberg @ 2008-01-07 12:28 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, andi, clameter, a.p.zijlstra, mingo, torvalds

From: Pekka Enberg <penberg@cs.helsinki.fi>

[ Upstream commits: 57ed3eda977a215f054102b460ab0eb5d8d112e6,
  6b6adc22a01941165d5af9a3e69e28e948b28f47, and
  158a962422e4a54dc256b6a9b9562f3d30d34d9c ]

This adds a read-only /proc/slabinfo file on SLUB, that makes slabtop work.

[ mingo@elte.hu: build fix. ]
[ torvalds@linux-foundation.org: config unification. ]    
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 fs/proc/proc_misc.c      |    4 -
 include/linux/slab.h     |    5 ++
 include/linux/slab_def.h |    3 -
 init/Kconfig             |    6 ++
 mm/slab.c                |    2 
 mm/slub.c                |  112 +++++++++++++++++++++++++++++++++++++++++------
 6 files changed, 113 insertions(+), 19 deletions(-)

Index: linux-2.6.23.y/fs/proc/proc_misc.c
===================================================================
--- linux-2.6.23.y.orig/fs/proc/proc_misc.c	2008-01-07 14:07:50.000000000 +0200
+++ linux-2.6.23.y/fs/proc/proc_misc.c	2008-01-07 14:14:17.000000000 +0200
@@ -397,7 +397,7 @@
 };
 #endif
 
-#ifdef CONFIG_SLAB
+#ifdef CONFIG_SLABINFO
 static int slabinfo_open(struct inode *inode, struct file *file)
 {
 	return seq_open(file, &slabinfo_op);
@@ -709,7 +709,7 @@
 #endif
 	create_seq_entry("stat", 0, &proc_stat_operations);
 	create_seq_entry("interrupts", 0, &proc_interrupts_operations);
-#ifdef CONFIG_SLAB
+#ifdef CONFIG_SLABINFO
 	create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
 #ifdef CONFIG_DEBUG_SLAB_LEAK
 	create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations);
Index: linux-2.6.23.y/include/linux/slab.h
===================================================================
--- linux-2.6.23.y.orig/include/linux/slab.h	2008-01-07 14:07:55.000000000 +0200
+++ linux-2.6.23.y/include/linux/slab.h	2008-01-07 14:14:17.000000000 +0200
@@ -269,5 +269,10 @@
 	return kmalloc(size, flags | __GFP_ZERO);
 }
 
+#ifdef CONFIG_SLABINFO
+extern const struct seq_operations slabinfo_op;
+ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
+#endif
+
 #endif	/* __KERNEL__ */
 #endif	/* _LINUX_SLAB_H */
Index: linux-2.6.23.y/include/linux/slab_def.h
===================================================================
--- linux-2.6.23.y.orig/include/linux/slab_def.h	2008-01-07 14:07:55.000000000 +0200
+++ linux-2.6.23.y/include/linux/slab_def.h	2008-01-07 14:14:17.000000000 +0200
@@ -95,7 +95,4 @@
 
 #endif	/* CONFIG_NUMA */
 
-extern const struct seq_operations slabinfo_op;
-ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
-
 #endif	/* _LINUX_SLAB_DEF_H */
Index: linux-2.6.23.y/init/Kconfig
===================================================================
--- linux-2.6.23.y.orig/init/Kconfig	2008-01-07 14:07:55.000000000 +0200
+++ linux-2.6.23.y/init/Kconfig	2008-01-07 14:14:17.000000000 +0200
@@ -573,6 +573,12 @@
 
 endmenu		# General setup
 
+config SLABINFO
+	bool
+	depends on PROC_FS
+	depends on SLAB || SLUB
+	default y
+
 config RT_MUTEXES
 	boolean
 	select PLIST
Index: linux-2.6.23.y/mm/slab.c
===================================================================
--- linux-2.6.23.y.orig/mm/slab.c	2008-01-07 14:07:55.000000000 +0200
+++ linux-2.6.23.y/mm/slab.c	2008-01-07 14:14:17.000000000 +0200
@@ -4082,7 +4082,7 @@
 	schedule_delayed_work(work, round_jiffies_relative(REAPTIMEOUT_CPUC));
 }
 
-#ifdef CONFIG_PROC_FS
+#ifdef CONFIG_SLABINFO
 
 static void print_slabinfo_header(struct seq_file *m)
 {
Index: linux-2.6.23.y/mm/slub.c
===================================================================
--- linux-2.6.23.y.orig/mm/slub.c	2008-01-07 14:07:55.000000000 +0200
+++ linux-2.6.23.y/mm/slub.c	2008-01-07 14:14:17.000000000 +0200
@@ -2789,6 +2789,19 @@
 	return slab_alloc(s, gfpflags, node, caller);
 }
 
+static unsigned long count_partial(struct kmem_cache_node *n)
+{
+	unsigned long flags;
+	unsigned long x = 0;
+	struct page *page;
+
+	spin_lock_irqsave(&n->list_lock, flags);
+	list_for_each_entry(page, &n->partial, lru)
+		x += page->inuse;
+	spin_unlock_irqrestore(&n->list_lock, flags);
+	return x;
+}
+
 #if defined(CONFIG_SYSFS) && defined(CONFIG_SLUB_DEBUG)
 static int validate_slab(struct kmem_cache *s, struct page *page,
 						unsigned long *map)
@@ -3171,19 +3184,6 @@
 	return n;
 }
 
-static unsigned long count_partial(struct kmem_cache_node *n)
-{
-	unsigned long flags;
-	unsigned long x = 0;
-	struct page *page;
-
-	spin_lock_irqsave(&n->list_lock, flags);
-	list_for_each_entry(page, &n->partial, lru)
-		x += page->inuse;
-	spin_unlock_irqrestore(&n->list_lock, flags);
-	return x;
-}
-
 enum slab_stat_type {
 	SL_FULL,
 	SL_PARTIAL,
@@ -3823,3 +3823,89 @@
 
 __initcall(slab_sysfs_init);
 #endif
+
+/*
+ * The /proc/slabinfo ABI
+ */
+#ifdef CONFIG_SLABINFO
+
+ssize_t slabinfo_write(struct file *file, const char __user * buffer,
+                       size_t count, loff_t *ppos)
+{
+	return -EINVAL;
+}
+
+
+static void print_slabinfo_header(struct seq_file *m)
+{
+	seq_puts(m, "slabinfo - version: 2.1\n");
+	seq_puts(m, "# name            <active_objs> <num_objs> <objsize> "
+		 "<objperslab> <pagesperslab>");
+	seq_puts(m, " : tunables <limit> <batchcount> <sharedfactor>");
+	seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
+	seq_putc(m, '\n');
+}
+
+static void *s_start(struct seq_file *m, loff_t *pos)
+{
+	loff_t n = *pos;
+
+	down_read(&slub_lock);
+	if (!n)
+		print_slabinfo_header(m);
+
+	return seq_list_start(&slab_caches, *pos);
+}
+
+static void *s_next(struct seq_file *m, void *p, loff_t *pos)
+{
+	return seq_list_next(p, &slab_caches, pos);
+}
+
+static void s_stop(struct seq_file *m, void *p)
+{
+	up_read(&slub_lock);
+}
+
+static int s_show(struct seq_file *m, void *p)
+{
+	unsigned long nr_partials = 0;
+	unsigned long nr_slabs = 0;
+	unsigned long nr_inuse = 0;
+	unsigned long nr_objs;
+	struct kmem_cache *s;
+	int node;
+
+	s = list_entry(p, struct kmem_cache, list);
+
+	for_each_online_node(node) {
+		struct kmem_cache_node *n = get_node(s, node);
+
+		if (!n)
+			continue;
+
+		nr_partials += n->nr_partial;
+		nr_slabs += atomic_long_read(&n->nr_slabs);
+		nr_inuse += count_partial(n);
+	}
+
+	nr_objs = nr_slabs * s->objects;
+	nr_inuse += (nr_slabs - nr_partials) * s->objects;
+
+	seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d", s->name, nr_inuse,
+		   nr_objs, s->size, s->objects, (1 << s->order));
+	seq_printf(m, " : tunables %4u %4u %4u", 0, 0, 0);
+	seq_printf(m, " : slabdata %6lu %6lu %6lu", nr_slabs, nr_slabs,
+		   0UL);
+	seq_putc(m, '\n');
+	return 0;
+}
+
+const struct seq_operations slabinfo_op = {
+	.start = s_start,
+	.next = s_next,
+	.stop = s_stop,
+	.show = s_show,
+};
+
+#endif /* CONFIG_SLABINFO */

^ permalink raw reply	[flat|nested] 94+ messages in thread

end of thread, other threads:[~2008-01-07 12:28 UTC | newest]

Thread overview: 94+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-07 17:50 Major regression on hackbench with SLUB Steven Rostedt
2007-12-07 17:55 ` Ingo Molnar
2007-12-07 17:59 ` Linus Torvalds
2007-12-07 18:36   ` Linus Torvalds
2007-12-07 18:58     ` Steven Rostedt
2007-12-08 22:16     ` Steven Rostedt
2007-12-10  7:38       ` Björn Steinbrink
2007-12-10 14:00         ` Steven Rostedt
2007-12-09  0:28     ` Steven Rostedt
2007-12-13 22:11     ` Christoph Lameter
2007-12-11 14:33 ` Major regression on hackbench with SLUB (more numbers) Ingo Molnar
2007-12-13 22:22   ` Christoph Lameter
2007-12-14  4:24     ` Christoph Lameter
2007-12-14  6:15       ` Steven Rostedt
2007-12-21 12:09       ` Ingo Molnar
2007-12-21 12:26         ` Ingo Molnar
2007-12-21 16:26           ` Christoph Lameter
2007-12-21 16:33             ` Ingo Molnar
2007-12-21 21:56               ` Christoph Lameter
2007-12-21 16:18         ` Christoph Lameter
2007-12-21 16:44           ` Linus Torvalds
2007-12-21 22:11             ` Christoph Lameter
2007-12-21 22:16               ` Peter Zijlstra
2007-12-21 22:17                 ` Peter Zijlstra
2007-12-21 22:27                   ` Christoph Lameter
2007-12-21 22:54                     ` Ingo Molnar
2007-12-21 23:20                       ` David Miller
2007-12-22  9:45                         ` Ingo Molnar
2007-12-24 19:24                           ` Christoph Lameter
2007-12-21 23:27                       ` Andrew Morton
2007-12-21 23:51                       ` Christoph Lameter
2007-12-22  0:28                       ` Andi Kleen
2007-12-22  0:33                         ` Chuck Ebbert
2007-12-22  2:19                         ` Matt Mackall
2007-12-22  2:44                           ` Andi Kleen
2007-12-22 10:03                         ` Ingo Molnar
2007-12-22 12:37                           ` Andi Kleen
2007-12-22 12:51                             ` Pekka Enberg
2007-12-22 12:54                               ` Andi Kleen
2007-12-22 13:27                                 ` Pekka Enberg
2007-12-22 13:01                             ` Alexey Dobriyan
2007-12-22 18:01                           ` Linus Torvalds
2007-12-22 19:09                             ` Ingo Molnar
2007-12-22 19:29                               ` Ingo Molnar
2007-12-22 22:52                               ` Jason L Tibbitts III
2007-12-24  3:59                                 ` Alessandro Suardi
2007-12-22 19:25                             ` Theodore Tso
2007-12-22 21:00                               ` Linus Torvalds
2007-12-22 21:50                                 ` Al Viro
2007-12-22 23:29                                   ` Al Viro
2007-12-22 22:10                                 ` Willy Tarreau
2007-12-23  0:59                                   ` Steven Rostedt
2007-12-23  5:12                                     ` Willy Tarreau
2007-12-23 14:15                                       ` Andi Kleen
2007-12-24  3:45                                         ` Theodore Tso
2007-12-24 19:21                                           ` Christoph Lameter
2007-12-24 23:37                                             ` Theodore Tso
2007-12-25  3:34                                               ` Andi Kleen
2008-01-01 12:47                                                 ` Theodore Tso
2008-01-01 15:19                                                   ` Andi Kleen
2008-01-01 16:23                                                   ` [patch] slub: provide /proc/slabinfo Ingo Molnar
2008-01-05  0:27                                                     ` Arjan van de Ven
2008-01-05  0:49                                                       ` Linus Torvalds
2007-12-26 21:31                                               ` Major regression on hackbench with SLUB (more numbers) Christoph Lameter
2007-12-26 22:16                                                 ` Al Viro
2007-12-27  5:51                                                   ` Christoph Lameter
2007-12-27 20:28                                                     ` SLUB sysfs support Christoph Lameter
2007-12-27 22:59                                                       ` Al Viro
2007-12-27 23:22                                                         ` Christoph Lameter
2007-12-27 23:53                                                           ` Christoph Lameter
2007-12-27 23:58                                                             ` Al Viro
2007-12-28  0:02                                                               ` Christoph Lameter
2007-12-28  0:45                                                                 ` Al Viro
2007-12-28  2:19                                                                   ` Christoph Lameter
2007-12-28  3:26                                                                     ` Al Viro
2008-01-02 20:25                                                                       ` Christoph Lameter
2007-12-27 23:54                                                           ` Al Viro
2007-12-28  9:00                                                   ` Major regression on hackbench with SLUB (more numbers) Ingo Molnar
2007-12-28 14:52                                                     ` Steven Rostedt
2007-12-22 19:46                             ` slabtop replacement was " Andi Kleen
2007-12-22 23:28                               ` Karol Swietlicki
2007-12-29 18:08                                 ` Karol Swietlicki
2007-12-21 22:49               ` Linus Torvalds
2007-12-21 17:44         ` Pekka Enberg
2007-12-21 22:22           ` Christoph Lameter
2007-12-21 22:37             ` Christoph Lameter
2007-12-21 22:51               ` Linus Torvalds
2007-12-21 23:17                 ` Ingo Molnar
2007-12-21 23:40                   ` Pekka Enberg
2007-12-21 23:54                   ` Christoph Lameter
2007-12-22  0:02                     ` Chuck Ebbert
2007-12-21 22:52               ` Steven Rostedt
2007-12-21 22:56               ` Ingo Molnar
2008-01-07 12:28 [PATCH] slub: provide /proc/slabinfo 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;
as well as URLs for NNTP newsgroup(s).