On Fri, Jul 24, 2015 at 12:55:35PM -0400, Chris Metcalf wrote:
On 07/23/2015 12:42 PM, Frederic Weisbecker wrote:Because I don't want to send an IPI if the CPU already had bits set in
+unsigned long __tick_nohz_set_tick_dependency(enum tick_dependency_bit bit,Why not use set_bit() here? It is suitably atomic.
+ 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;
+}
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.