From mboxrd@z Thu Jan 1 00:00:00 1970 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 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Gleixner Subject: Re: [PATCH v3 01/22] timer: Allow to check when the timer callback has not finished yet Date: Wed, 18 Nov 2015 23:32:28 +0100 (CET) Message-ID: References: <1447853127-3461-1-git-send-email-pmladek@suse.com> <1447853127-3461-2-git-send-email-pmladek@suse.com> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Return-path: In-Reply-To: <1447853127-3461-2-git-send-email-pmladek@suse.com> Sender: owner-linux-mm@kvack.org 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 List-Id: linux-api@vger.kernel.org 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, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org