Re: [PATCH 1/2] mm/slub: optimize alloc/free fastpath by removing preemption on/off

From: Steven Rostedt
Date: Mon Jan 05 2015 - 21:25:15 EST


On Tue, 6 Jan 2015 10:32:47 +0900
Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> wrote:


> > > +++ b/mm/slub.c
> > > @@ -2398,13 +2398,15 @@ redo:
> > > * reading from one cpu area. That does not matter as long
> > > * as we end up on the original cpu again when doing the cmpxchg.
> > > *
> > > - * Preemption is disabled for the retrieval of the tid because that
> > > - * must occur from the current processor. We cannot allow rescheduling
> > > - * on a different processor between the determination of the pointer
> > > - * and the retrieval of the tid.
> > > + * We should guarantee that tid and kmem_cache are retrieved on
> > > + * the same cpu. It could be different if CONFIG_PREEMPT so we need
> > > + * to check if it is matched or not.
> > > */
> > > - preempt_disable();
> > > - c = this_cpu_ptr(s->cpu_slab);
> > > + do {
> > > + tid = this_cpu_read(s->cpu_slab->tid);
> > > + c = this_cpu_ptr(s->cpu_slab);
> > > + } while (IS_ENABLED(CONFIG_PREEMPT) && unlikely(tid != c->tid));
> > > + barrier();
> >
> > Help maintenance more if barrier is documented in commit message.
>
> Hello,
>
> Okay. Will add some information about this barrier in commit message.

A comment in the commit message is useless. Adding a small comment
above the barrier() call itself would be much more useful.

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/