On 08/28, Peter Zijlstra wrote: > > Surely we can do this locklessly.. I'll go try harder still.
I doubt... Even ignore work->func check, somehow you need to ensure that work->next == new can't be changed durung cmpxchg(..., new). Anyway, if this is possible, can't you do this on top of 1-4 I sent? There are simple, and solve the problems we discusssed. Off-topic. This is really minor, bur can't we simplify llist_add()? static inline bool llist_add(struct llist_node *new, struct llist_head *head) { struct llist_node *old; do { old = ACCESS_ONCE(head->first); new->next = old; } while (cmpxchg(&head->first, old, new) != old); return old == NULL; } looks simpler and saves a couple of insns. The likely case should assume that cmpxchg() succeeds after the 1st attempt. If it fails, another LOAD from head->first should be very cheap. And note this ACCESS_ONCE(head->first) above. I think that (in theory) the current code needs it too. But only in theory, I guess. Oleg. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/