* + slub-reduce-duplicate-creation-on-the-first-object.patch added to -mm tree
@ 2014-06-24 21:56 akpm
0 siblings, 0 replies; 2+ messages in thread
From: akpm @ 2014-06-24 21:56 UTC (permalink / raw
To: weiyang, cl, iamjoonsoo.kim, penberg, rientjes, mm-commits
The patch titled
Subject: slub: reduce duplicate creation on the first object
has been added to the -mm tree. Its filename is
slub-reduce-duplicate-creation-on-the-first-object.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/slub-reduce-duplicate-creation-on-the-first-object.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/slub-reduce-duplicate-creation-on-the-first-object.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Wei Yang <weiyang@linux.vnet.ibm.com>
Subject: slub: reduce duplicate creation on the first object
When a kmem_cache is created with ctor, each object in the kmem_cache will
be initialized before use. In the slub implementation, the first object
will be initialized twice.
This patch avoids the duplication of initialization of the first object.
Fixes commit 7656c72b5a63: ("SLUB: add macros for scanning objects in a
slab").
Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/slub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -puN mm/slub.c~slub-reduce-duplicate-creation-on-the-first-object mm/slub.c
--- a/mm/slub.c~slub-reduce-duplicate-creation-on-the-first-object
+++ a/mm/slub.c
@@ -1403,7 +1403,7 @@ static struct page *new_slab(struct kmem
memset(start, POISON_INUSE, PAGE_SIZE << order);
last = start;
- for_each_object(p, s, start, page->objects) {
+ for_each_object(p, s, start + s->size, page->objects - 1) {
setup_object(s, page, last);
set_freepointer(s, last, p);
last = p;
_
Patches currently in -mm which might be from weiyang@linux.vnet.ibm.com are
slub-reduce-duplicate-creation-on-the-first-object.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
* + slub-reduce-duplicate-creation-on-the-first-object.patch added to -mm tree
@ 2014-07-07 19:10 akpm
0 siblings, 0 replies; 2+ messages in thread
From: akpm @ 2014-07-07 19:10 UTC (permalink / raw
To: weiyang, cl, iamjoonsoo.kim, penberg, rientjes, mm-commits
The patch titled
Subject: slub: avoid duplicate creation on the first object
has been added to the -mm tree. Its filename is
slub-reduce-duplicate-creation-on-the-first-object.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/slub-reduce-duplicate-creation-on-the-first-object.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/slub-reduce-duplicate-creation-on-the-first-object.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Wei Yang <weiyang@linux.vnet.ibm.com>
Subject: slub: avoid duplicate creation on the first object
When a kmem_cache is created with ctor, each object in the kmem_cache will
be initialized before ready to use. While in slub implementation, the
first object will be initialized twice.
This patch reduces the duplication of initialization of the first object.
Fix commit 7656c72b ("SLUB: add macros for scanning objects in a slab").
Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/slub.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff -puN mm/slub.c~slub-reduce-duplicate-creation-on-the-first-object mm/slub.c
--- a/mm/slub.c~slub-reduce-duplicate-creation-on-the-first-object
+++ a/mm/slub.c
@@ -283,6 +283,10 @@ static inline void set_freepointer(struc
for (__p = (__addr); __p < (__addr) + (__objects) * (__s)->size;\
__p += (__s)->size)
+#define for_each_object_idx(__p, __idx, __s, __addr, __objects) \
+ for (__p = (__addr), __idx = 1; __idx <= __objects;\
+ __p += (__s)->size, __idx++)
+
/* Determine object index from a given position */
static inline int slab_index(void *p, struct kmem_cache *s, void *addr)
{
@@ -1379,9 +1383,9 @@ static struct page *new_slab(struct kmem
{
struct page *page;
void *start;
- void *last;
void *p;
int order;
+ int idx;
BUG_ON(flags & GFP_SLAB_BUG_MASK);
@@ -1402,14 +1406,13 @@ static struct page *new_slab(struct kmem
if (unlikely(s->flags & SLAB_POISON))
memset(start, POISON_INUSE, PAGE_SIZE << order);
- last = start;
- for_each_object(p, s, start, page->objects) {
- setup_object(s, page, last);
- set_freepointer(s, last, p);
- last = p;
+ for_each_object_idx(p, idx, s, start, page->objects) {
+ setup_object(s, page, p);
+ if (likely(idx < page->objects))
+ set_freepointer(s, p, p + s->size);
+ else
+ set_freepointer(s, p, NULL);
}
- setup_object(s, page, last);
- set_freepointer(s, last, NULL);
page->freelist = start;
page->inuse = page->objects;
_
Patches currently in -mm which might be from weiyang@linux.vnet.ibm.com are
slub-reduce-duplicate-creation-on-the-first-object.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-07 19:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-07 19:10 + slub-reduce-duplicate-creation-on-the-first-object.patch added to -mm tree akpm
-- strict thread matches above, loose matches on Subject: below --
2014-06-24 21:56 akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.