Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933675AbbKRWdf (ORCPT ); Wed, 18 Nov 2015 17:33:35 -0500 Received: from www.linutronix.de ([62.245.132.108]:34859 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933423AbbKRWdb (ORCPT ); Wed, 18 Nov 2015 17:33:31 -0500 Date: Wed, 18 Nov 2015 23:32:28 +0100 (CET) From: Thomas Gleixner To: Petr Mladek cc: Andrew Morton , Oleg Nesterov , Tejun Heo , Ingo Molnar , Peter Zijlstra , Steven Rostedt , "Paul E. McKenney" , Josh Triplett , Linus Torvalds , Jiri Kosina , Borislav Petkov , Michal Hocko , linux-mm@kvack.org, Vlastimil Babka , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 01/22] timer: Allow to check when the timer callback has not finished yet In-Reply-To: <1447853127-3461-2-git-send-email-pmladek@suse.com> Message-ID: References: <1447853127-3461-1-git-send-email-pmladek@suse.com> <1447853127-3461-2-git-send-email-pmladek@suse.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1105 Lines: 28 On Wed, 18 Nov 2015, Petr Mladek wrote: > timer_pending() checks whether the list of callbacks is empty. > Each callback is removed from the list before it is called, > see call_timer_fn() in __run_timers(). > > Sometimes we need to make sure that the callback has finished. > For example, if we want to free some resources that are accessed > by the callback. > > For this purpose, this patch adds timer_active(). It checks both > the list of callbacks and the running_timer. It takes the base_lock > to see a consistent state. > > I plan to use it to implement delayed works in kthread worker. > But I guess that it will have wider use. In fact, I wonder if > timer_pending() is misused in some situations. Well. That's nice and good. But how will that new function solve anything? After you drop the lock the state is not longer valid. Thanks, tglx -- 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/