Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751572AbbFGW5l (ORCPT ); Sun, 7 Jun 2015 18:57:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37194 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751196AbbFGW5i (ORCPT ); Sun, 7 Jun 2015 18:57:38 -0400 Date: Mon, 8 Jun 2015 00:56:38 +0200 From: Oleg Nesterov To: Peter Zijlstra Cc: umgwanakikbuti@gmail.com, mingo@elte.hu, ktkhai@parallels.com, rostedt@goodmis.org, tglx@linutronix.de, juri.lelli@gmail.com, pang.xunlei@linaro.org, wanpeng.li@linux.intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 08/14] hrtimer: Allow hrtimer::function() to free the timer Message-ID: <20150607225638.GA9329@redhat.com> References: <20150605084836.364306429@infradead.org> <20150605085205.723058588@infradead.org> <20150607223317.GA5193@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150607223317.GA5193@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 992 Lines: 41 On 06/08, Oleg Nesterov wrote: > > And I simply can not understand the complication in hrtimer_active(), > please help! Sorry for another off-topic email, but I don't even understand the usage of hrtimer_active(). Say, do_nanosleep() hrtimer_start_expires(&t->timer, mode); if (!hrtimer_active(&t->timer)) t->task = NULL; why? Assuming that hrtimer_active() is correct, it can only return false if t->task was already cleared by hrtimer_wakeup(). OTOH. perf_cpu_hrtimer_restart() does if (hrtimer_active(hr)) return; if (!hrtimer_callback_running(hr)) __hrtimer_start_range_ns(...); why it can't simply do if (!hrtimer_active(hr)) // implies !hrtimer_callback_running() __hrtimer_start_range_ns(...); Confused. Oleg. -- 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/