[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55B2794A.8040707@ezchip.com>
Date: Fri, 24 Jul 2015 13:43:38 -0400
From: Chris Metcalf <cmetcalf@...hip.com>
To: Frederic Weisbecker <fweisbec@...il.com>
CC: LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Preeti U Murthy <preeti@...ux.vnet.ibm.com>,
Christoph Lameter <cl@...ux.com>,
Ingo Molnar <mingo@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>,
Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH 05/10] nohz: New tick dependency mask
On 07/24/2015 01:16 PM, Frederic Weisbecker wrote:
> On Fri, Jul 24, 2015 at 12:55:35PM -0400, Chris Metcalf wrote:
>> On 07/23/2015 12:42 PM, Frederic Weisbecker wrote:
>>> +unsigned long __tick_nohz_set_tick_dependency(enum tick_dependency_bit bit,
>>> + unsigned long *dep)
>>> +{
>>> + unsigned long prev;
>>> + unsigned long old = *dep;
>>> + unsigned long mask = BIT_MASK(bit);
>>> +
>>> + while ((prev = cmpxchg(dep, old, old | mask)) != old) {
>>> + old = prev;
>>> + cpu_relax();
>>> + }
>>> +
>>> + return prev;
>>> +}
>> Why not use set_bit() here? It is suitably atomic.
> Because I don't want to send an IPI if the CPU already had bits set in
> the dependency.
>
> Ideally I need something like test_and_set_bit() but which returns the
> whole previous value and not just the previous value of the bit.
Ah, of course. Peter, maybe we need atomic_or_return() as part
of your new atomic_or/_and/_xor series? Certainly on tilegx, and
likely other architectures, we can do better than Frederic's
cmpxchg() loop.
--
Chris Metcalf, EZChip Semiconductor
http://www.ezchip.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists