Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297204
b: refs/heads/master
c: 0ad9500
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and Pekka Enberg committed Jan 24, 2012
1 parent 63a1c47 commit bb991a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 42c8c99cd891184bf4bcf6f09d62c54e42599453
refs/heads/master: 0ad9500e16fe24aa55809a2b00e0d2d0e658fc71
10 changes: 9 additions & 1 deletion trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ static inline void *get_freepointer(struct kmem_cache *s, void *object)
return *(void **)(object + s->offset);
}

static void prefetch_freepointer(const struct kmem_cache *s, void *object)
{
prefetch(object + s->offset);
}

static inline void *get_freepointer_safe(struct kmem_cache *s, void *object)
{
void *p;
Expand Down Expand Up @@ -2309,6 +2314,8 @@ static __always_inline void *slab_alloc(struct kmem_cache *s,
object = __slab_alloc(s, gfpflags, node, addr, c);

else {
void *next_object = get_freepointer_safe(s, object);

/*
* The cmpxchg will only match if there was no additional
* operation and if we are on the right processor.
Expand All @@ -2324,11 +2331,12 @@ static __always_inline void *slab_alloc(struct kmem_cache *s,
if (unlikely(!this_cpu_cmpxchg_double(
s->cpu_slab->freelist, s->cpu_slab->tid,
object, tid,
get_freepointer_safe(s, object), next_tid(tid)))) {
next_object, next_tid(tid)))) {

note_cmpxchg_failure("slab_alloc", s, tid);
goto redo;
}
prefetch_freepointer(s, next_object);
stat(s, ALLOC_FASTPATH);
}

Expand Down

0 comments on commit bb991a0

Please sign in to comment.