Re: [PATCH] slub: /proc/slabinfo ABI compatibility
On Mon, 24 Dec 2007, Pekka Enberg wrote: > On Dec 24, 2007 9:12 PM, Christoph Lameter <[EMAIL PROTECTED]> wrote: > > Hmmm... What is the combination of config variables that causes this? I > > moved the count_partial function in mm in order to make the merge of slab > > defrag easier. > > I think it's CONFIG_PROC_FS without CONFIG_SYSFS. The only user of count_partial is in slab_objects() which is in a section that is #if defined(CONFIG_SYSFS) && defined(CONFIG_SLUB_DEBUG) There should be no use if CONFIG_SYSFS is not set. I think we get a warning about a function that is never called when compiling the current mm code without SLUB_DEBUG or CONFIG_SYSFS (because the slab defrag use has not been merged yet). In mm count_partial() is always defined. In Linus tree count_partial() comes just before slab_objects(). -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
On Mon, 24 Dec 2007, Pekka Enberg wrote: On Dec 24, 2007 9:12 PM, Christoph Lameter [EMAIL PROTECTED] wrote: Hmmm... What is the combination of config variables that causes this? I moved the count_partial function in mm in order to make the merge of slab defrag easier. I think it's CONFIG_PROC_FS without CONFIG_SYSFS. The only user of count_partial is in slab_objects() which is in a section that is #if defined(CONFIG_SYSFS) defined(CONFIG_SLUB_DEBUG) There should be no use if CONFIG_SYSFS is not set. I think we get a warning about a function that is never called when compiling the current mm code without SLUB_DEBUG or CONFIG_SYSFS (because the slab defrag use has not been merged yet). In mm count_partial() is always defined. In Linus tree count_partial() comes just before slab_objects(). -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
On Dec 24, 2007 9:12 PM, Christoph Lameter <[EMAIL PROTECTED]> wrote: > Hmmm... What is the combination of config variables that causes this? I > moved the count_partial function in mm in order to make the merge of slab > defrag easier. I think it's CONFIG_PROC_FS without CONFIG_SYSFS. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
On Sat, 22 Dec 2007, Ingo Molnar wrote: > Pekka, i stuck your patch into the x86.git random-test-grid, and it > found the following build error after a few iterations: > > mm/slub.c: In function 's_show': > mm/slub.c:4188: error: implicit declaration of function 'count_partial' > > find the (tested) fix below. Hmmm... What is the combination of config variables that causes this? I moved the count_partial function in mm in order to make the merge of slab defrag easier. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
On Sat, 22 Dec 2007, Ingo Molnar wrote: Pekka, i stuck your patch into the x86.git random-test-grid, and it found the following build error after a few iterations: mm/slub.c: In function 's_show': mm/slub.c:4188: error: implicit declaration of function 'count_partial' find the (tested) fix below. Hmmm... What is the combination of config variables that causes this? I moved the count_partial function in mm in order to make the merge of slab defrag easier. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
On Dec 24, 2007 9:12 PM, Christoph Lameter [EMAIL PROTECTED] wrote: Hmmm... What is the combination of config variables that causes this? I moved the count_partial function in mm in order to make the merge of slab defrag easier. I think it's CONFIG_PROC_FS without CONFIG_SYSFS. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
Hi Ingo, On Dec 22, 2007 3:40 PM, Ingo Molnar <[EMAIL PROTECTED]> wrote: > ah, didnt see that. Could you pick up bits of my patch because it seems > to do a better job, such as proper c99 initializer: [snip] > also, my patch fixes all the warnings as well, not just the errors. So > please give it a second look ;-) Sure, I'm fine with that. Can you Andrew please drop mine and use Ingo's instead? Acked-by: Pekka Enberg <[EMAIL PROTECTED]> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
* Pekka Enberg <[EMAIL PROTECTED]> wrote: > Hi Ingo, > > On Dec 22, 2007 3:14 PM, Ingo Molnar <[EMAIL PROTECTED]> wrote: > > Also please apply the cleanup patch below, it fixes 34 checkpatch errors > > and warnings in mm/slub.c. > > Those are already fixed in -mm: > > http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc5/2.6.24-rc5-mm1/broken-out/slub-fix-coding-style-violations.patch > http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc5/2.6.24-rc5-mm1/broken-out/slub-fix-coding-style-violations-checkpatch-fixes.patch ah, didnt see that. Could you pick up bits of my patch because it seems to do a better job, such as proper c99 initializer: +static struct notifier_block __cpuinitdata slab_notifier = { + .notifier_call = slab_cpuup_callback +}; instead of your: +static struct notifier_block __cpuinitdata slab_notifier = { + _cpuup_callback, NULL, 0 +}; also, my patch fixes all the warnings as well, not just the errors. So please give it a second look ;-) Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
Hi Ingo, On Dec 22, 2007 3:37 PM, Ingo Molnar <[EMAIL PROTECTED]> wrote: > Pekka, i stuck your patch into the x86.git random-test-grid, and it > found the following build error after a few iterations: > > mm/slub.c: In function 's_show': > mm/slub.c:4188: error: implicit declaration of function 'count_partial' Looks good. Thanks! Reviewed-by: Pekka Enberg <[EMAIL PROTECTED]> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
* Ingo Molnar <[EMAIL PROTECTED]> wrote: > > From: Pekka Enberg <[EMAIL PROTECTED]> > > > > This adds a read-only /proc/slabinfo file that is ABI compatible with > > SLAB for SLUB. > > > > Cc: Ingo Molnar <[EMAIL PROTECTED]> > > Tested-by: Ingo Molnar <[EMAIL PROTECTED]> Pekka, i stuck your patch into the x86.git random-test-grid, and it found the following build error after a few iterations: mm/slub.c: In function 's_show': mm/slub.c:4188: error: implicit declaration of function 'count_partial' find the (tested) fix below. Ingo -> Subject: SLUB: build fix From: Ingo Molnar <[EMAIL PROTECTED]> fix: mm/slub.c: In function 's_show': mm/slub.c:4188: error: implicit declaration of function 'count_partial' Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]> --- mm/slub.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) Index: linux/mm/slub.c === --- linux.orig/mm/slub.c +++ linux/mm/slub.c @@ -3079,6 +3079,19 @@ void *__kmalloc_node_track_caller(size_t 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(>list_lock, flags); + list_for_each_entry(page, >partial, lru) + x += page->inuse; + spin_unlock_irqrestore(>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) @@ -3464,19 +3477,6 @@ static int list_locations(struct kmem_ca 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(>list_lock, flags); - list_for_each_entry(page, >partial, lru) - x += page->inuse; - spin_unlock_irqrestore(>list_lock, flags); - return x; -} - enum slab_stat_type { SL_FULL, SL_PARTIAL, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
Hi Ingo, On Dec 22, 2007 3:14 PM, Ingo Molnar <[EMAIL PROTECTED]> wrote: > Also please apply the cleanup patch below, it fixes 34 checkpatch errors > and warnings in mm/slub.c. Those are already fixed in -mm: http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc5/2.6.24-rc5-mm1/broken-out/slub-fix-coding-style-violations.patch http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc5/2.6.24-rc5-mm1/broken-out/slub-fix-coding-style-violations-checkpatch-fixes.patch Pekka -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
* Pekka J Enberg <[EMAIL PROTECTED]> wrote: > From: Pekka Enberg <[EMAIL PROTECTED]> > > This adds a read-only /proc/slabinfo file that is ABI compatible with > SLAB for SLUB. > > Cc: Ingo Molnar <[EMAIL PROTECTED]> Tested-by: Ingo Molnar <[EMAIL PROTECTED]> Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
* Pekka J Enberg <[EMAIL PROTECTED]> wrote: > From: Pekka Enberg <[EMAIL PROTECTED]> > > This adds a read-only /proc/slabinfo file that is ABI compatible with > SLAB for SLUB. cool :-) I tried your patch and slabtop works just fine: --> Active / Total Objects (% used): 31939 / 32363 (98.7%) Active / Total Slabs (% used) : 2082 / 2082 (100.0%) Active / Total Caches (% used) : 87 / 165 (52.7%) Active / Total Size (% used) : 9225.02K / 9325.23K (98.9%) Minimum / Average / Maximum Object : 0.08K / 0.29K / 4.12K OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME 7618 7610 99%0.15K293 26 1172K sysfs_dir_cache 3045 3045 100%0.27K203 15 812K dentry 2856 2852 99%0.14K102 28 408K selinux_inode_security 2760 2721 98%0.17K120 23 480K buffer_head 2737 2736 99%0.23K161 17 644K vm_area_struct <-- Tested-by: Ingo Molnar <[EMAIL PROTECTED]> Also please apply the cleanup patch below, it fixes 34 checkpatch errors and warnings in mm/slub.c. Ingo > Subject: SLUB: fix checkpatch warnings From: Ingo Molnar <[EMAIL PROTECTED]> fix checkpatch --file mm/slub.c errors and warnings. $ q-code-quality-compare errors lines of code errors/KLOC mm/slub.c [before] 224204 5.2 mm/slub.c [after]04210 0 no code changed: textdata bss dec hex filename 221958634 136 3096578f5 slub.o.before 221958634 136 3096578f5 slub.o.after md5: 93cdfbec2d6450622163c590e1064358 slub.o.before.asm 93cdfbec2d6450622163c590e1064358 slub.o.after.asm Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]> --- mm/slub.c | 92 +- 1 file changed, 49 insertions(+), 43 deletions(-) Index: linux/mm/slub.c === --- linux.orig/mm/slub.c +++ linux/mm/slub.c @@ -354,22 +354,22 @@ static void print_section(char *text, u8 printk(KERN_ERR "%8s 0x%p: ", text, addr + i); newline = 0; } - printk(" %02x", addr[i]); + printk(KERN_CONT " %02x", addr[i]); offset = i % 16; ascii[offset] = isgraph(addr[i]) ? addr[i] : '.'; if (offset == 15) { - printk(" %s\n",ascii); + printk(KERN_CONT " %s\n", ascii); newline = 1; } } if (!newline) { i %= 16; while (i < 16) { - printk(" "); + printk(KERN_CONT " "); ascii[i] = ' '; i++; } - printk(" %s\n", ascii); + printk(KERN_CONT " %s\n", ascii); } } @@ -529,7 +529,7 @@ static void init_object(struct kmem_cach if (s->flags & __OBJECT_POISON) { memset(p, POISON_FREE, s->objsize - 1); - p[s->objsize -1] = POISON_END; + p[s->objsize - 1] = POISON_END; } if (s->flags & SLAB_RED_ZONE) @@ -558,7 +558,7 @@ static void restore_bytes(struct kmem_ca static int check_bytes_and_report(struct kmem_cache *s, struct page *page, u8 *object, char *what, - u8* start, unsigned int value, unsigned int bytes) + u8 *start, unsigned int value, unsigned int bytes) { u8 *fault; u8 *end; @@ -682,9 +682,10 @@ static int check_object(struct kmem_cach endobject, red, s->inuse - s->objsize)) return 0; } else { - if ((s->flags & SLAB_POISON) && s->objsize < s->inuse) - check_bytes_and_report(s, page, p, "Alignment padding", endobject, - POISON_INUSE, s->inuse - s->objsize); + if ((s->flags & SLAB_POISON) && s->objsize < s->inuse) { + check_bytes_and_report(s, page, p, "Alignment padding", + endobject, POISON_INUSE, s->inuse - s->objsize); + } } if (s->flags & SLAB_POISON) { @@ -692,7 +693,7 @@ static int check_object(struct kmem_cach (!check_bytes_and_report(s, page, p, "Poison", p, POISON_FREE, s->objsize - 1) || !check_bytes_and_report(s, page, p, "Poison", - p + s->objsize -1, POISON_END, 1))) + p + s->objsize - 1, POISON_END, 1))) return 0; /*
[PATCH] slub: /proc/slabinfo ABI compatibility
From: Pekka Enberg <[EMAIL PROTECTED]> This adds a read-only /proc/slabinfo file that is ABI compatible with SLAB for SLUB. Cc: Ingo Molnar <[EMAIL PROTECTED]> Cc: Andi Kleen <[EMAIL PROTECTED]> Cc: Christoph Lameter <[EMAIL PROTECTED]> Cc: Peter Zijlstra <[EMAIL PROTECTED]> Signed-off-by: Pekka Enberg <[EMAIL PROTECTED]> --- fs/proc/proc_misc.c | 17 ++ include/linux/slub_def.h |2 + mm/slub.c| 79 +++ 3 files changed, 98 insertions(+) Index: linux-2.6/fs/proc/proc_misc.c === --- linux-2.6.orig/fs/proc/proc_misc.c 2007-12-22 14:43:48.0 +0200 +++ linux-2.6/fs/proc/proc_misc.c 2007-12-22 14:44:11.0 +0200 @@ -451,6 +451,20 @@ #endif #endif +#ifdef CONFIG_SLUB +static int slabinfo_open(struct inode *inode, struct file *file) +{ + return seq_open(file, _op); +} + +static const struct file_operations proc_slabinfo_operations = { + .open = slabinfo_open, + .read = seq_read, + .llseek = seq_lseek, + .release= seq_release, +}; +#endif + static int show_stat(struct seq_file *p, void *v) { int i; @@ -734,6 +748,9 @@ create_seq_entry("slab_allocators", 0 ,_slabstats_operations); #endif #endif +#ifdef CONFIG_SLUB + create_seq_entry("slabinfo", S_IWUSR|S_IRUGO, _slabinfo_operations); +#endif create_seq_entry("buddyinfo",S_IRUGO, _file_operations); create_seq_entry("pagetypeinfo", S_IRUGO, _file_ops); create_seq_entry("vmstat",S_IRUGO, _vmstat_file_operations); Index: linux-2.6/include/linux/slub_def.h === --- linux-2.6.orig/include/linux/slub_def.h 2007-12-22 14:43:48.0 +0200 +++ linux-2.6/include/linux/slub_def.h 2007-12-22 14:44:11.0 +0200 @@ -200,4 +200,6 @@ } #endif +extern const struct seq_operations slabinfo_op; + #endif /* _LINUX_SLUB_DEF_H */ Index: linux-2.6/mm/slub.c === --- linux-2.6.orig/mm/slub.c2007-12-22 14:43:48.0 +0200 +++ linux-2.6/mm/slub.c 2007-12-22 14:44:37.0 +0200 @@ -4123,3 +4123,82 @@ __initcall(slab_sysfs_init); #endif + +/* + * The /proc/slabinfo ABI + */ +#ifdef CONFIG_PROC_FS + +static void print_slabinfo_header(struct seq_file *m) +{ + seq_puts(m, "slabinfo - version: 2.1\n"); + seq_puts(m, "# name " +" "); + seq_puts(m, " : tunables "); + seq_puts(m, " : slabdata "); + seq_putc(m, '\n'); +} + +static void *s_start(struct seq_file *m, loff_t *pos) +{ + loff_t n = *pos; + + down_read(_lock); + if (!n) + print_slabinfo_header(m); + + return seq_list_start(_caches, *pos); +} + +static void *s_next(struct seq_file *m, void *p, loff_t *pos) +{ + return seq_list_next(p, _caches, pos); +} + +static void s_stop(struct seq_file *m, void *p) +{ + up_read(_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(>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_PROC_FS */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] slub: /proc/slabinfo ABI compatibility
From: Pekka Enberg [EMAIL PROTECTED] This adds a read-only /proc/slabinfo file that is ABI compatible with SLAB for SLUB. Cc: Ingo Molnar [EMAIL PROTECTED] Cc: Andi Kleen [EMAIL PROTECTED] Cc: Christoph Lameter [EMAIL PROTECTED] Cc: Peter Zijlstra [EMAIL PROTECTED] Signed-off-by: Pekka Enberg [EMAIL PROTECTED] --- fs/proc/proc_misc.c | 17 ++ include/linux/slub_def.h |2 + mm/slub.c| 79 +++ 3 files changed, 98 insertions(+) Index: linux-2.6/fs/proc/proc_misc.c === --- linux-2.6.orig/fs/proc/proc_misc.c 2007-12-22 14:43:48.0 +0200 +++ linux-2.6/fs/proc/proc_misc.c 2007-12-22 14:44:11.0 +0200 @@ -451,6 +451,20 @@ #endif #endif +#ifdef CONFIG_SLUB +static int slabinfo_open(struct inode *inode, struct file *file) +{ + return seq_open(file, slabinfo_op); +} + +static const struct file_operations proc_slabinfo_operations = { + .open = slabinfo_open, + .read = seq_read, + .llseek = seq_lseek, + .release= seq_release, +}; +#endif + static int show_stat(struct seq_file *p, void *v) { int i; @@ -734,6 +748,9 @@ create_seq_entry(slab_allocators, 0 ,proc_slabstats_operations); #endif #endif +#ifdef CONFIG_SLUB + create_seq_entry(slabinfo, S_IWUSR|S_IRUGO, proc_slabinfo_operations); +#endif create_seq_entry(buddyinfo,S_IRUGO, fragmentation_file_operations); create_seq_entry(pagetypeinfo, S_IRUGO, pagetypeinfo_file_ops); create_seq_entry(vmstat,S_IRUGO, proc_vmstat_file_operations); Index: linux-2.6/include/linux/slub_def.h === --- linux-2.6.orig/include/linux/slub_def.h 2007-12-22 14:43:48.0 +0200 +++ linux-2.6/include/linux/slub_def.h 2007-12-22 14:44:11.0 +0200 @@ -200,4 +200,6 @@ } #endif +extern const struct seq_operations slabinfo_op; + #endif /* _LINUX_SLUB_DEF_H */ Index: linux-2.6/mm/slub.c === --- linux-2.6.orig/mm/slub.c2007-12-22 14:43:48.0 +0200 +++ linux-2.6/mm/slub.c 2007-12-22 14:44:37.0 +0200 @@ -4123,3 +4123,82 @@ __initcall(slab_sysfs_init); #endif + +/* + * The /proc/slabinfo ABI + */ +#ifdef CONFIG_PROC_FS + +static void print_slabinfo_header(struct seq_file *m) +{ + seq_puts(m, slabinfo - version: 2.1\n); + seq_puts(m, # nameactive_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_PROC_FS */ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
* Pekka J Enberg [EMAIL PROTECTED] wrote: From: Pekka Enberg [EMAIL PROTECTED] This adds a read-only /proc/slabinfo file that is ABI compatible with SLAB for SLUB. cool :-) I tried your patch and slabtop works just fine: -- Active / Total Objects (% used): 31939 / 32363 (98.7%) Active / Total Slabs (% used) : 2082 / 2082 (100.0%) Active / Total Caches (% used) : 87 / 165 (52.7%) Active / Total Size (% used) : 9225.02K / 9325.23K (98.9%) Minimum / Average / Maximum Object : 0.08K / 0.29K / 4.12K OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME 7618 7610 99%0.15K293 26 1172K sysfs_dir_cache 3045 3045 100%0.27K203 15 812K dentry 2856 2852 99%0.14K102 28 408K selinux_inode_security 2760 2721 98%0.17K120 23 480K buffer_head 2737 2736 99%0.23K161 17 644K vm_area_struct -- Tested-by: Ingo Molnar [EMAIL PROTECTED] Also please apply the cleanup patch below, it fixes 34 checkpatch errors and warnings in mm/slub.c. Ingo Subject: SLUB: fix checkpatch warnings From: Ingo Molnar [EMAIL PROTECTED] fix checkpatch --file mm/slub.c errors and warnings. $ q-code-quality-compare errors lines of code errors/KLOC mm/slub.c [before] 224204 5.2 mm/slub.c [after]04210 0 no code changed: textdata bss dec hex filename 221958634 136 3096578f5 slub.o.before 221958634 136 3096578f5 slub.o.after md5: 93cdfbec2d6450622163c590e1064358 slub.o.before.asm 93cdfbec2d6450622163c590e1064358 slub.o.after.asm Signed-off-by: Ingo Molnar [EMAIL PROTECTED] --- mm/slub.c | 92 +- 1 file changed, 49 insertions(+), 43 deletions(-) Index: linux/mm/slub.c === --- linux.orig/mm/slub.c +++ linux/mm/slub.c @@ -354,22 +354,22 @@ static void print_section(char *text, u8 printk(KERN_ERR %8s 0x%p: , text, addr + i); newline = 0; } - printk( %02x, addr[i]); + printk(KERN_CONT %02x, addr[i]); offset = i % 16; ascii[offset] = isgraph(addr[i]) ? addr[i] : '.'; if (offset == 15) { - printk( %s\n,ascii); + printk(KERN_CONT %s\n, ascii); newline = 1; } } if (!newline) { i %= 16; while (i 16) { - printk( ); + printk(KERN_CONT); ascii[i] = ' '; i++; } - printk( %s\n, ascii); + printk(KERN_CONT %s\n, ascii); } } @@ -529,7 +529,7 @@ static void init_object(struct kmem_cach if (s-flags __OBJECT_POISON) { memset(p, POISON_FREE, s-objsize - 1); - p[s-objsize -1] = POISON_END; + p[s-objsize - 1] = POISON_END; } if (s-flags SLAB_RED_ZONE) @@ -558,7 +558,7 @@ static void restore_bytes(struct kmem_ca static int check_bytes_and_report(struct kmem_cache *s, struct page *page, u8 *object, char *what, - u8* start, unsigned int value, unsigned int bytes) + u8 *start, unsigned int value, unsigned int bytes) { u8 *fault; u8 *end; @@ -682,9 +682,10 @@ static int check_object(struct kmem_cach endobject, red, s-inuse - s-objsize)) return 0; } else { - if ((s-flags SLAB_POISON) s-objsize s-inuse) - check_bytes_and_report(s, page, p, Alignment padding, endobject, - POISON_INUSE, s-inuse - s-objsize); + if ((s-flags SLAB_POISON) s-objsize s-inuse) { + check_bytes_and_report(s, page, p, Alignment padding, + endobject, POISON_INUSE, s-inuse - s-objsize); + } } if (s-flags SLAB_POISON) { @@ -692,7 +693,7 @@ static int check_object(struct kmem_cach (!check_bytes_and_report(s, page, p, Poison, p, POISON_FREE, s-objsize - 1) || !check_bytes_and_report(s, page, p, Poison, - p + s-objsize -1, POISON_END, 1))) + p + s-objsize - 1, POISON_END, 1))) return 0; /* * check_pad_bytes cleans up on its own. @@ -781,7 +782,8 @@
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
* Pekka J Enberg [EMAIL PROTECTED] wrote: From: Pekka Enberg [EMAIL PROTECTED] This adds a read-only /proc/slabinfo file that is ABI compatible with SLAB for SLUB. Cc: Ingo Molnar [EMAIL PROTECTED] Tested-by: Ingo Molnar [EMAIL PROTECTED] Ingo -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
Hi Ingo, On Dec 22, 2007 3:14 PM, Ingo Molnar [EMAIL PROTECTED] wrote: Also please apply the cleanup patch below, it fixes 34 checkpatch errors and warnings in mm/slub.c. Those are already fixed in -mm: http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc5/2.6.24-rc5-mm1/broken-out/slub-fix-coding-style-violations.patch http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc5/2.6.24-rc5-mm1/broken-out/slub-fix-coding-style-violations-checkpatch-fixes.patch Pekka -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
* Ingo Molnar [EMAIL PROTECTED] wrote: From: Pekka Enberg [EMAIL PROTECTED] This adds a read-only /proc/slabinfo file that is ABI compatible with SLAB for SLUB. Cc: Ingo Molnar [EMAIL PROTECTED] Tested-by: Ingo Molnar [EMAIL PROTECTED] Pekka, i stuck your patch into the x86.git random-test-grid, and it found the following build error after a few iterations: mm/slub.c: In function 's_show': mm/slub.c:4188: error: implicit declaration of function 'count_partial' find the (tested) fix below. Ingo - Subject: SLUB: build fix From: Ingo Molnar [EMAIL PROTECTED] fix: mm/slub.c: In function 's_show': mm/slub.c:4188: error: implicit declaration of function 'count_partial' Signed-off-by: Ingo Molnar [EMAIL PROTECTED] --- mm/slub.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) Index: linux/mm/slub.c === --- linux.orig/mm/slub.c +++ linux/mm/slub.c @@ -3079,6 +3079,19 @@ void *__kmalloc_node_track_caller(size_t 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) @@ -3464,19 +3477,6 @@ static int list_locations(struct kmem_ca 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, -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
Hi Ingo, On Dec 22, 2007 3:37 PM, Ingo Molnar [EMAIL PROTECTED] wrote: Pekka, i stuck your patch into the x86.git random-test-grid, and it found the following build error after a few iterations: mm/slub.c: In function 's_show': mm/slub.c:4188: error: implicit declaration of function 'count_partial' Looks good. Thanks! Reviewed-by: Pekka Enberg [EMAIL PROTECTED] -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
* Pekka Enberg [EMAIL PROTECTED] wrote: Hi Ingo, On Dec 22, 2007 3:14 PM, Ingo Molnar [EMAIL PROTECTED] wrote: Also please apply the cleanup patch below, it fixes 34 checkpatch errors and warnings in mm/slub.c. Those are already fixed in -mm: http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc5/2.6.24-rc5-mm1/broken-out/slub-fix-coding-style-violations.patch http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc5/2.6.24-rc5-mm1/broken-out/slub-fix-coding-style-violations-checkpatch-fixes.patch ah, didnt see that. Could you pick up bits of my patch because it seems to do a better job, such as proper c99 initializer: +static struct notifier_block __cpuinitdata slab_notifier = { + .notifier_call = slab_cpuup_callback +}; instead of your: +static struct notifier_block __cpuinitdata slab_notifier = { + slab_cpuup_callback, NULL, 0 +}; also, my patch fixes all the warnings as well, not just the errors. So please give it a second look ;-) Ingo -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] slub: /proc/slabinfo ABI compatibility
Hi Ingo, On Dec 22, 2007 3:40 PM, Ingo Molnar [EMAIL PROTECTED] wrote: ah, didnt see that. Could you pick up bits of my patch because it seems to do a better job, such as proper c99 initializer: [snip] also, my patch fixes all the warnings as well, not just the errors. So please give it a second look ;-) Sure, I'm fine with that. Can you Andrew please drop mine and use Ingo's instead? Acked-by: Pekka Enberg [EMAIL PROTECTED] -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/