public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/8] slub: Replace ctor field with ops field in /sys/slab/*
@ 2008-07-19 12:30 Pekka J Enberg
  2008-07-19 17:44 ` OGAWA Hirofumi
  0 siblings, 1 reply; 4+ messages in thread
From: Pekka J Enberg @ 2008-07-19 12:30 UTC (permalink / raw)
  To: linux-kernel, cl, akpm, riel

From: Christoph Lameter <clameter@sgi.com>

Create an ops field in /sys/slab/*/ops to contain all the operations defined
on a slab. This will be used to display the additional operations that will
be defined soon.

Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 mm/slub.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 1b910ab..f21ffb9 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3843,16 +3843,18 @@ static ssize_t order_show(struct kmem_cache *s, char *buf)
 }
 SLAB_ATTR(order);
 
-static ssize_t ctor_show(struct kmem_cache *s, char *buf)
+static ssize_t ops_show(struct kmem_cache *s, char *buf)
 {
-	if (s->ctor) {
-		int n = sprint_symbol(buf, (unsigned long)s->ctor);
+	int x = 0;
 
-		return n + sprintf(buf + n, "\n");
+	if (s->ctor) {
+		x += sprintf(buf + x, "ctor : ");
+		x += sprint_symbol(buf + x, (unsigned long)s->ctor);
+		x += sprintf(buf + x, "\n");
 	}
-	return 0;
+	return x;
 }
-SLAB_ATTR_RO(ctor);
+SLAB_ATTR_RO(ops);
 
 static ssize_t aliases_show(struct kmem_cache *s, char *buf)
 {
@@ -4185,7 +4187,7 @@ static struct attribute *slab_attrs[] = {
 	&slabs_attr.attr,
 	&partial_attr.attr,
 	&cpu_slabs_attr.attr,
-	&ctor_attr.attr,
+	&ops_attr.attr,
 	&aliases_attr.attr,
 	&align_attr.attr,
 	&sanity_checks_attr.attr,
-- 
1.5.4.3


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

* Re: [PATCH 2/8] slub: Replace ctor field with ops field in /sys/slab/*
  2008-07-19 12:30 [PATCH 2/8] slub: Replace ctor field with ops field in /sys/slab/* Pekka J Enberg
@ 2008-07-19 17:44 ` OGAWA Hirofumi
  2008-07-19 17:47   ` OGAWA Hirofumi
  2008-07-21  9:08   ` Pekka Enberg
  0 siblings, 2 replies; 4+ messages in thread
From: OGAWA Hirofumi @ 2008-07-19 17:44 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: linux-kernel, cl, akpm, riel

Pekka J Enberg <penberg@cs.helsinki.fi> writes:

> +	if (s->ctor) {
> +		x += sprintf(buf + x, "ctor : ");
> +		x += sprint_symbol(buf + x, (unsigned long)s->ctor);
> +		x += sprintf(buf + x, "\n");

How about new "%pS" like following for it? If CONFIG_KALLSYMS=n, it has
difference though...

		x += sprintf(buf + x, "ctor : %pS\n", (unsigned long)s->ctor);
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

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

* Re: [PATCH 2/8] slub: Replace ctor field with ops field in /sys/slab/*
  2008-07-19 17:44 ` OGAWA Hirofumi
@ 2008-07-19 17:47   ` OGAWA Hirofumi
  2008-07-21  9:08   ` Pekka Enberg
  1 sibling, 0 replies; 4+ messages in thread
From: OGAWA Hirofumi @ 2008-07-19 17:47 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: linux-kernel, cl, akpm, riel

OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:

> Pekka J Enberg <penberg@cs.helsinki.fi> writes:
>
>> +	if (s->ctor) {
>> +		x += sprintf(buf + x, "ctor : ");
>> +		x += sprint_symbol(buf + x, (unsigned long)s->ctor);
>> +		x += sprintf(buf + x, "\n");
>
> How about new "%pS" like following for it? If CONFIG_KALLSYMS=n, it has
> difference though...
>
> 		x += sprintf(buf + x, "ctor : %pS\n", (unsigned long)s->ctor);

Oops, it should be pointer.

 		x += sprintf(buf + x, "ctor : %pS\n", s->ctor);
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

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

* Re: [PATCH 2/8] slub: Replace ctor field with ops field in /sys/slab/*
  2008-07-19 17:44 ` OGAWA Hirofumi
  2008-07-19 17:47   ` OGAWA Hirofumi
@ 2008-07-21  9:08   ` Pekka Enberg
  1 sibling, 0 replies; 4+ messages in thread
From: Pekka Enberg @ 2008-07-21  9:08 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: linux-kernel, cl, akpm, riel

Hi,

Pekka J Enberg <penberg@cs.helsinki.fi> writes:
> > +	if (s->ctor) {
> > +		x += sprintf(buf + x, "ctor : ");
> > +		x += sprint_symbol(buf + x, (unsigned long)s->ctor);
> > +		x += sprintf(buf + x, "\n");

On Sun, 2008-07-20 at 02:44 +0900, OGAWA Hirofumi wrote:
> How about new "%pS" like following for it? If CONFIG_KALLSYMS=n, it has
> difference though...
> 
> 		x += sprintf(buf + x, "ctor : %pS\n", (unsigned long)s->ctor);

Looks good to me. I'd prefer to wait until this patchset is merged and
do all of mm/slub.c in one go.

		Pekka


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

end of thread, other threads:[~2008-07-21  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-19 12:30 [PATCH 2/8] slub: Replace ctor field with ops field in /sys/slab/* Pekka J Enberg
2008-07-19 17:44 ` OGAWA Hirofumi
2008-07-19 17:47   ` OGAWA Hirofumi
2008-07-21  9:08   ` Pekka Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox