Thread (33 messages) flat view 33 messages, 5 authors, 2017-08-25

Re: [PATCH 5/6] powerpc/mm: Optimize detection of thread local mm's

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2017-07-25 01:04:13

On Tue, 2017-07-25 at 10:44 +1000, Nicholas Piggin wrote:
The two variants are just cleaner versions of the two variants you
already introduced.

static inline bool mm_activate_cpu(struct mm_struct *mm)
{
    if (!cpumask_test_cpu(smp_processor_id(), mm_cpumask(next))) {
        cpumask_set_cpu(smp_processor_id(), mm_cpumask(next));
#if CONFIG_PPC_BOOK3S_64
        atomic_inc(&mm->context.active_cpus);
#endif
        smp_mb();
        return true;
    }
    return false;
}
Well the above is what I originally wrote, which Michael encouraged me
to turn into a helper ;-) I was removing ifdef's from switch_mm in
this series...
I think it would be nicer to put something like that with
mm_is_thread_local etc definitions so you can see how it all works
in one place.
quoted
It gets messy either way.
quoted
The extra atomic does not need to be defined when it's not used either.

Also does it make sense to define it based on NR_CPUS > BITS_PER_LONG?
If it's <= then it should be similar load and compare, no?  
Right, we could.
quoted
Looks like a good optimisation though.  
Thx. It's a pre-req for further optimizations such as flushing the PID
when a single threaded process moves, so we don't have to constantly
scan the mask.
Yep, will be very interesting to see how much global tlbies can be
reduced.

Thanks,
Nick
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help