Re: [PATCH] SLUB: use have_arch_cmpxchg()

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Mathieu Desnoyers <mathieu.desnoyers@...>
Cc: Christoph Lameter <clameter@...>, <akpm@...>, <linux-kernel@...>, <mingo@...>
Date: Wednesday, August 22, 2007 - 12:24 pm

Hi Mathieu,

On 8/22/07, Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

Heh, that's an understatement, as now slub is starting to look a bit
like slab... ;-)  We need to hide that if-else maze into helper
functions for sure.

On 8/22/07, Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

I haven't been following on the cmpxchg_local() discussion too much so
the obvious question is: why do we do local_irq_save() for the _has_
cmpxchg() case here...

On 8/22/07, Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

...and preempt_disable() here?

On 8/22/07, Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

If you move the preempt_enable/local_irq_restore pair outside of the
if-else block, you can make a static inline function slob_get_object()
that does:

    static inline bool slob_get_object(struct kmem_cache *c, void **object)
    {
        if (have_arch_cmpxchg()) {
            if (unlikely(cmpxchg_local(&c->freelist, object,
                    object[c->offset]) != object))
                return false;
        } else {
            c->freelist = object[c->offset];
        }
        return true;
    }

And let the compiler optimize out the branch for the non-cmpxchg case.
Same for the reverse case too (i.e. slob_put_object).

                                Pekka
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 01/23] Fall back on interrupt disable in cmpxchg8b on..., Mathieu Desnoyers, (Mon Aug 20, 4:15 pm)
Re: [patch 01/23] Fall back on interrupt disable in cmpxchg8..., Christoph Lameter, (Mon Aug 20, 4:32 pm)
Re: [patch 01/23] Fall back on interrupt disable in cmpxchg8..., Mathieu Desnoyers, (Mon Aug 20, 4:41 pm)
Re: [patch 01/23] Fall back on interrupt disable in cmpxchg8..., Christoph Lameter, (Mon Aug 20, 4:46 pm)
Re: [patch 01/23] Fall back on interrupt disable in cmpxchg8..., Mathieu Desnoyers, (Mon Aug 20, 5:29 pm)
Re: [patch 01/23] Fall back on interrupt disable in cmpxchg8..., Christoph Lameter, (Mon Aug 20, 5:49 pm)
Re: [patch 01/23] Fall back on interrupt disable in cmpxchg8..., Mathieu Desnoyers, (Mon Aug 20, 5:54 pm)
Re: [patch 01/23] Fall back on interrupt disable in cmpxchg8..., Christoph Lameter, (Mon Aug 20, 6:07 pm)
[PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 21, 1:38 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Tue Aug 21, 7:14 pm)
Re: [PATCH] SLUB use cmpxchg_local, Peter Zijlstra, (Mon Aug 27, 2:52 am)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Mon Aug 27, 3:39 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Mon Aug 27, 6:15 pm)
Re: [PATCH] SLUB use cmpxchg_local, Peter Zijlstra, (Tue Aug 28, 3:12 am)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Tue Aug 28, 3:36 pm)
Re: [PATCH] SLUB use cmpxchg_local, Peter Zijlstra, (Tue Aug 28, 3:46 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Mon Aug 27, 4:22 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Mon Aug 27, 4:26 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Mon Aug 27, 4:39 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Mon Aug 27, 5:04 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Mon Aug 27, 5:10 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Mon Aug 27, 5:23 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Mon Aug 27, 5:38 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Mon Aug 27, 6:12 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Mon Aug 27, 6:27 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Mon Aug 27, 9:26 pm)
[PATCH] slub - Use local_t protection, Mathieu Desnoyers, (Tue Sep 4, 4:04 pm)
Re: [PATCH] slub - Use local_t protection, Christoph Lameter, (Tue Sep 4, 4:45 pm)
Re: [PATCH] slub - Use local_t protection, Mathieu Desnoyers, (Wed Sep 5, 9:06 am)
Re: [PATCH] slub - Use local_t protection, Christoph Lameter, (Wed Sep 12, 6:28 pm)
[PATCH] local_t protection (critical section), Mathieu Desnoyers, (Wed Sep 5, 9:04 am)
Re: [PATCH] local_t protection (critical section), Christoph Lameter, (Wed Sep 12, 6:33 pm)
Re: [PATCH] local_t protection (critical section), Mathieu Desnoyers, (Wed Sep 12, 7:00 pm)
Re: [PATCH] slub - Use local_t protection, Mathieu Desnoyers, (Wed Sep 5, 9:03 am)
[PATCH] local_t protection (critical section), Mathieu Desnoyers, (Tue Sep 4, 4:03 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Sep 4, 4:02 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 28, 8:07 am)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Tue Aug 28, 3:42 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Mon Aug 27, 6:29 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 21, 7:23 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 21, 7:50 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Tue Aug 21, 5:08 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 21, 7:12 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Tue Aug 21, 7:17 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 21, 7:39 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Tue Aug 21, 7:41 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 21, 7:47 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Tue Aug 21, 7:51 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 21, 8:03 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Tue Aug 21, 8:11 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 21, 8:26 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Tue Aug 21, 8:34 pm)
[PATCH] SLUB: use have_arch_cmpxchg(), Mathieu Desnoyers, (Wed Aug 22, 11:02 am)
Re: [PATCH] SLUB: use have_arch_cmpxchg(), Pekka Enberg, (Wed Aug 22, 12:24 pm)
Re: [PATCH] SLUB: use have_arch_cmpxchg(), Mathieu Desnoyers, (Mon Aug 27, 10:56 am)
Re: [PATCH] SLUB: use have_arch_cmpxchg(), Christoph Lameter, (Mon Aug 27, 3:43 pm)
Re: [PATCH] SLUB: use have_arch_cmpxchg(), Mathieu Desnoyers, (Mon Aug 27, 4:25 pm)
[PATCH] define have_arch_cmpxchg(), Mathieu Desnoyers, (Wed Aug 22, 11:00 am)
Re: [PATCH] define have_arch_cmpxchg(), Christoph Lameter, (Wed Aug 22, 2:50 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 21, 9:18 pm)
Re: [PATCH] SLUB use cmpxchg_local, Andi Kleen, (Tue Aug 21, 9:28 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 21, 8:38 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Tue Aug 21, 9:06 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Wed Aug 22, 9:45 am)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Wed Aug 22, 3:25 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Wed Aug 22, 4:09 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Wed Aug 22, 4:19 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Wed Aug 22, 4:29 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Wed Aug 22, 4:38 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Wed Aug 22, 4:33 pm)
Re: [PATCH] SLUB use cmpxchg_local, Andi Kleen, (Wed Aug 22, 9:46 am)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Wed Aug 22, 2:54 pm)
Re: [PATCH] SLUB use cmpxchg_local, Andi Kleen, (Wed Aug 22, 5:39 am)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 21, 9:12 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 21, 4:41 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Tue Aug 21, 5:36 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 21, 1:44 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Tue Aug 21, 5:10 pm)
Re: [PATCH] SLUB use cmpxchg_local, Mathieu Desnoyers, (Tue Aug 21, 7:21 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Tue Aug 21, 7:38 pm)
Re: [PATCH] SLUB use cmpxchg_local, Christoph Lameter, (Tue Aug 21, 7:35 pm)
Re: [patch 01/23] Fall back on interrupt disable in cmpxchg8..., Mathieu Desnoyers, (Mon Aug 20, 6:29 pm)
[PATCH] SLUB Use cmpxchg() everywhere, Mathieu Desnoyers, (Tue Aug 21, 1:38 pm)