Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753542AbbHaPV3 (ORCPT ); Mon, 31 Aug 2015 11:21:29 -0400 Received: from ns.horizon.com ([71.41.210.147]:11366 "HELO ns.horizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753198AbbHaPV2 (ORCPT ); Mon, 31 Aug 2015 11:21:28 -0400 Date: 31 Aug 2015 11:21:25 -0400 Message-ID: <20150831152125.2143.qmail@ns.horizon.com> From: "George Spelvin" To: linux@horizon.com, oleg@redhat.com Subject: Re: [PATCH] task_work: remove fifo ordering guarantee Cc: eric.dumazet@gmail.com, linux-kernel@vger.kernel.org, mingo@kernel.org In-Reply-To: <20150831132210.GD31015@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1214 Lines: 30 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/