Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 248624
b: refs/heads/master
c: 1393d9a
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Lameter authored and Pekka Enberg committed May 17, 2011
1 parent 0b97740 commit f04ff79
Show file tree
Hide file tree
Showing 2 changed files with 14 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: 6332aa9d25e911cc97aa9cc09acee21afda07ea6
refs/heads/master: 1393d9a1857471f816d0be1ccc1d6433a86050f6
14 changes: 13 additions & 1 deletion trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,18 @@ static inline void *get_freepointer(struct kmem_cache *s, void *object)
return *(void **)(object + s->offset);
}

static inline void *get_freepointer_safe(struct kmem_cache *s, void *object)
{
void *p;

#ifdef CONFIG_DEBUG_PAGEALLOC
probe_kernel_read(&p, (void **)(object + s->offset), sizeof(p));
#else
p = get_freepointer(s, object);
#endif
return p;
}

static inline void set_freepointer(struct kmem_cache *s, void *object, void *fp)
{
*(void **)(object + s->offset) = fp;
Expand Down Expand Up @@ -1933,7 +1945,7 @@ 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(s, object), next_tid(tid)))) {
get_freepointer_safe(s, object), next_tid(tid)))) {

note_cmpxchg_failure("slab_alloc", s, tid);
goto redo;
Expand Down

0 comments on commit f04ff79

Please sign in to comment.