From: Christoph Lameter <cl@linux.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Pekka Enberg <penberg@cs.helsinki.fi>,
akpm@linux-foundation.org, Mel Gorman <mel@skynet.ie>,
andi@firstfloor.org, Rik van Riel <riel@redhat.com>,
Dave Chinner <dchinner@redhat.com>,
Christoph Hellwig <hch@lst.de>, Michal Hocko <mhocko@suse.com>,
Mike Kravetz <mike.kravetz@oracle.com>
Subject: [RFC 1/7] slub: Replace ctor field with ops field in /sys/slab/*
Date: Thu, 20 Dec 2018 19:21:56 +0000 [thread overview]
Message-ID: <01000167cd113509-2c85d8a3-8e0e-4cb6-a745-88733e448471-000000@email.amazonses.com> (raw)
In-Reply-To: <20181220192145.023162076@linux.com>
[-- Attachment #1: ctor_to_ops --]
[-- Type: text/plain, Size: 1285 bytes --]
Create an ops field in /sys/slab/*/ops to contain all the callback
operations defined for a slab cache. This will be used to display
the additional callbacks that will be defined soon to enable
defragmentation.
Display the existing ctor callback in the ops fields contents.
Signed-off-by: Christoph Lameter <cl@linux.com>
---
mm/slub.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
Index: linux/mm/slub.c
===================================================================
--- linux.orig/mm/slub.c
+++ linux/mm/slub.c
@@ -4994,13 +4994,18 @@ static ssize_t cpu_partial_store(struct
}
SLAB_ATTR(cpu_partial);
-static ssize_t ctor_show(struct kmem_cache *s, char *buf)
+static ssize_t ops_show(struct kmem_cache *s, char *buf)
{
+ int x = 0;
+
if (!s->ctor)
return 0;
- return sprintf(buf, "%pS\n", s->ctor);
+
+ if (s->ctor)
+ x += sprintf(buf + x, "ctor : %pS\n", s->ctor);
+ return x;
}
-SLAB_ATTR_RO(ctor);
+SLAB_ATTR_RO(ops);
static ssize_t aliases_show(struct kmem_cache *s, char *buf)
{
@@ -5413,7 +5418,7 @@ static struct attribute *slab_attrs[] =
&objects_partial_attr.attr,
&partial_attr.attr,
&cpu_slabs_attr.attr,
- &ctor_attr.attr,
+ &ops_attr.attr,
&aliases_attr.attr,
&align_attr.attr,
&hwcache_align_attr.attr,
WARNING: multiple messages have this Message-ID
From: Christoph Lameter <cl@linux.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: akpm@linux-foundation.org
Cc: Mel Gorman <mel@skynet.ie>
Cc: andi@firstfloor.org
Cc: Rik van Riel <riel@redhat.com>
Cc: Dave Chinner <dchinner@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Subject: [RFC 1/7] slub: Replace ctor field with ops field in /sys/slab/*
Date: Thu, 20 Dec 2018 19:21:56 +0000 [thread overview]
Message-ID: <01000167cd113509-2c85d8a3-8e0e-4cb6-a745-88733e448471-000000@email.amazonses.com> (raw)
Message-ID: <20181220192156.8wYilYpa21PIOyXjO4sOxH5wYgpBuiCyOHOyE0G2FIg@z> (raw)
In-Reply-To: <20181220192145.023162076@linux.com>
[-- Attachment #1: ctor_to_ops --]
[-- Type: text/plain, Size: 1286 bytes --]
Create an ops field in /sys/slab/*/ops to contain all the callback
operations defined for a slab cache. This will be used to display
the additional callbacks that will be defined soon to enable
defragmentation.
Display the existing ctor callback in the ops fields contents.
Signed-off-by: Christoph Lameter <cl@linux.com>
---
mm/slub.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
Index: linux/mm/slub.c
===================================================================
--- linux.orig/mm/slub.c
+++ linux/mm/slub.c
@@ -4994,13 +4994,18 @@ static ssize_t cpu_partial_store(struct
}
SLAB_ATTR(cpu_partial);
-static ssize_t ctor_show(struct kmem_cache *s, char *buf)
+static ssize_t ops_show(struct kmem_cache *s, char *buf)
{
+ int x = 0;
+
if (!s->ctor)
return 0;
- return sprintf(buf, "%pS\n", s->ctor);
+
+ if (s->ctor)
+ x += sprintf(buf + x, "ctor : %pS\n", s->ctor);
+ return x;
}
-SLAB_ATTR_RO(ctor);
+SLAB_ATTR_RO(ops);
static ssize_t aliases_show(struct kmem_cache *s, char *buf)
{
@@ -5413,7 +5418,7 @@ static struct attribute *slab_attrs[] =
&objects_partial_attr.attr,
&partial_attr.attr,
&cpu_slabs_attr.attr,
- &ctor_attr.attr,
+ &ops_attr.attr,
&aliases_attr.attr,
&align_attr.attr,
&hwcache_align_attr.attr,
next parent reply other threads:[~2018-12-20 19:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20181220192145.023162076@linux.com>
2018-12-20 19:21 ` Christoph Lameter [this message]
2018-12-20 19:21 ` Christoph Lameter
2018-12-20 19:21 ` [RFC 2/7] slub: Add defrag_ratio field and sysfs support Christoph Lameter
2018-12-20 19:21 ` Christoph Lameter
2018-12-20 19:21 ` [RFC 3/7] slub: Add isolate() and migrate() methods Christoph Lameter
2018-12-20 19:21 ` Christoph Lameter
2018-12-20 19:22 ` [RFC 4/7] slub: Sort slab cache list and establish maximum objects for defrag slabs Christoph Lameter
2018-12-20 19:22 ` Christoph Lameter
2018-12-20 19:22 ` [RFC 5/7] slub: Slab defrag core Christoph Lameter
2018-12-20 19:22 ` Christoph Lameter
2018-12-20 19:22 ` [RFC 6/7] slub: Extend slabinfo to support -D and -F options Christoph Lameter
2018-12-20 19:22 ` Christoph Lameter
2018-12-20 19:22 ` [RFC 7/7] xarray: Implement migration function for objects Christoph Lameter
2018-12-20 19:22 ` Christoph Lameter
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=01000167cd113509-2c85d8a3-8e0e-4cb6-a745-88733e448471-000000@email.amazonses.com \
--to=cl@linux.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=dchinner@redhat.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@skynet.ie \
--cc=mhocko@suse.com \
--cc=mike.kravetz@oracle.com \
--cc=penberg@cs.helsinki.fi \
--cc=riel@redhat.com \
--cc=willy@infradead.org \
/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