Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754066AbXJVGIk (ORCPT ); Mon, 22 Oct 2007 02:08:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750908AbXJVGIb (ORCPT ); Mon, 22 Oct 2007 02:08:31 -0400 Received: from mx12.go2.pl ([193.17.41.142]:56260 "EHLO poczta.o2.pl" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750709AbXJVGIa (ORCPT ); Mon, 22 Oct 2007 02:08:30 -0400 Date: Mon, 22 Oct 2007 08:11:43 +0200 From: Jarek Poplawski To: Oleg Nesterov Cc: "Maciej W\. Rozycki" , Andy Fleming , Andrew Morton , Jeff Garzik , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes Message-ID: <20071022061143.GA973@ff.dom.local> References: <20071015125301.GC3015@ff.dom.local> <20071016062108.GB1000@ff.dom.local> <20071017085809.GA1658@ff.dom.local> <20071018063157.GA1694@ff.dom.local> <20071018070531.GA2065@ff.dom.local> <20071018154819.GA425@tv-sign.ru> <20071019075014.GA1765@ff.dom.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20071019075014.GA1765@ff.dom.local> User-Agent: Mutt/1.4.2.2i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1819 Lines: 39 On Fri, Oct 19, 2007 at 09:50:14AM +0200, Jarek Poplawski wrote: > On Thu, Oct 18, 2007 at 07:48:19PM +0400, Oleg Nesterov wrote: > > On 10/18, Jarek Poplawski wrote: > > > > > > +/** > > > + * flush_work_sync - block until a work_struct's callback has terminated > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > Hmm... > > > > > + * Similar to cancel_work_sync() but will only busy wait (without cancel) > > > + * if the work is queued. > > > > Yes, it won't block, but will spin in busy-wait loop until all other works > > scheduled before this work are finished. Not good. After that it really > > blocks waiting for this work to complete. > > > > And I am a bit confused. We can't use flush_workqueue() because some of the > > queued work_structs may take rtnl_lock, yes? But in that case we can't use > > the new flush_work_sync() helper as well, no? OK, I know I'm dumber and dumber everyday, but it seems in a hurry I got it wrong again or miss something (as usual): these all flushes are rtnl lockup vulnerable wrt. other work functions, but cancel_work_sync looks perfectly fine... (Or am I wrong because: ...?) Then, if by any chance I'm right, something like flush_work_sync (or changed flush_scheduled_work, if there is no problem with such a change of implementation) could be safely (if it's called without locks used by flushed work only) done cancel_work_sync() way, by running a work function after try_to_grab_pending() returns 1 (after list_del_init - of course without respecting a queue order). Regards, Jarek P. - 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/