Oleg Nesterov wrote: > Actually you need a single tail pointer, See 158e1645e07f3e9f7e49. > But this doesn't matter.
(This uses a circularly linked list, keeping a pointer to the tail, and tail->next pointing to the head.) Yes, if you're not trying to be lockless, that works quite well. > And this also means that the next writer which does task_work_add() + > task_work_cancel() will be suprised. Worse, this means that work->func() > doesn't own its callback_head/container_of. The previous tail is visible > to task_work_run(). I forgot about task_work_cancel()! Yes, supporting that as well would be a problem, and make a messy algorithm even messier. > Perhaps I missed something. But to me this all looks too clever ;) > Personally I'd prefer to just add another spinlock_t. > > But so far I hope we can keep this stupid but simple "reverse the list" > loop. It *is* too complicated. That's why I described it: to discourage people from implementing it. -- 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/