Re: Kernel crash after using new Intel NIC (igb)

From: Arun Sharma
Date: Fri May 27 2011 - 13:52:07 EST


On 5/26/11 8:27 PM, Eric Dumazet wrote:

Looks good. Thanks for taking care of this.

+static bool atomic_add_unless_return(atomic_t *ptr, int a, int u, int *newv)
+{
+ int cur, old = atomic_read(ptr);
+
+ while (old != u) {
+ *newv = old + a;
+ cur = atomic_cmpxchg(ptr, old, *newv);
+ if (cur == old)
+ return true;
+ old = cur;
+ }
+ return false;
+}

This looks very similar to atomic_add_unless(). If we had a

__atomic_add_unless() that returned "old", we could then do:

atomic_add_unless() { return __atomic_add_unless() != u }
atomic_add_unless_return() { return __atomic_add_unless() + a}

-Arun


--
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/