Message ID | 20181025094437.18951-2-richard.weiyang@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/3] mm, slub: not retrieve cpu_slub again in new_slab_objects() | expand |
On Thu, 25 Oct 2018, Wei Yang wrote: > In current code, we use two forms to access s->cpu_slab > > * raw_cpu_ptr() > * this_cpu_ptr() Ok the only difference is that for CONFIG_DEBUG_PREEMPT we will do the debug checks twice. That tolerable I think but is this really a worthwhile change?
On Thu, Oct 25, 2018 at 01:53:06PM +0000, Christopher Lameter wrote: >On Thu, 25 Oct 2018, Wei Yang wrote: > >> In current code, we use two forms to access s->cpu_slab >> >> * raw_cpu_ptr() >> * this_cpu_ptr() > >Ok the only difference is that for CONFIG_DEBUG_PREEMPT we will do the >debug checks twice. > >That tolerable I think but is this really a worthwhile change? Agree. My purpose is to make unify the access, looks easy for me to read the code. You can decide whether to change this or not :-)
diff --git a/mm/slub.c b/mm/slub.c index 11e49d95e0ac..715372a786e3 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2643,7 +2643,7 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s, */ do { tid = this_cpu_read(s->cpu_slab->tid); - c = raw_cpu_ptr(s->cpu_slab); + c = this_cpu_ptr(s->cpu_slab); } while (IS_ENABLED(CONFIG_PREEMPT) && unlikely(tid != READ_ONCE(c->tid))); @@ -2916,7 +2916,7 @@ static __always_inline void do_slab_free(struct kmem_cache *s, */ do { tid = this_cpu_read(s->cpu_slab->tid); - c = raw_cpu_ptr(s->cpu_slab); + c = this_cpu_ptr(s->cpu_slab); } while (IS_ENABLED(CONFIG_PREEMPT) && unlikely(tid != READ_ONCE(c->tid)));
In current code, we use two forms to access s->cpu_slab * raw_cpu_ptr() * this_cpu_ptr() This patch unify the access by replacing raw_cpu_ptr() with this_cpu_ptr(). Signed-off-by: Wei Yang <richard.weiyang@gmail.com> --- mm/slub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)