Skip to content

Commit

Permalink
slab: replace smp_read_barrier_depends() with lockless_dereference()
Browse files Browse the repository at this point in the history
Recently lockless_dereference() was added which can be used in place of
hard-coding smp_read_barrier_depends().  The following PATCH makes the
change.

Signed-off-by: Pranith Kumar <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
pranith authored and torvalds committed Dec 11, 2014
1 parent c871ac4 commit 8df0c2d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mm/slab.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@ cache_from_memcg_idx(struct kmem_cache *s, int idx)

rcu_read_lock();
params = rcu_dereference(s->memcg_params);
cachep = params->memcg_caches[idx];
rcu_read_unlock();

/*
* Make sure we will access the up-to-date value. The code updating
* memcg_caches issues a write barrier to match this (see
* memcg_register_cache()).
*/
smp_read_barrier_depends();
cachep = lockless_dereference(params->memcg_caches[idx]);
rcu_read_unlock();

return cachep;
}

Expand Down

0 comments on commit 8df0c2d

Please sign in to comment.