Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753296AbbFCKkq (ORCPT ); Wed, 3 Jun 2015 06:40:46 -0400 Received: from relay.parallels.com ([195.214.232.42]:38426 "EHLO relay.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751565AbbFCKkh (ORCPT ); Wed, 3 Jun 2015 06:40:37 -0400 Message-ID: <1433328026.23588.15.camel@odin.com> Subject: Re: [RFC][PATCH 3/7] sched: Allow balance callbacks for check_class_changed() From: Kirill Tkhai To: Peter Zijlstra CC: Kirill Tkhai , "umgwanakikbuti@gmail.com" , "mingo@elte.hu" , "ktkhai@parallels.com" , "rostedt@goodmis.org" , "juri.lelli@gmail.com" , "pang.xunlei@linaro.org" , "oleg@redhat.com" , "linux-kernel@vger.kernel.org" , "luca.abeni@unitn.it" Date: Wed, 3 Jun 2015 13:40:26 +0300 In-Reply-To: <20150603073227.GW3644@twins.programming.kicks-ass.net> References: <20150601135818.506080835@infradead.org> <20150601140839.852669281@infradead.org> <449191433253514@web6g.yandex.ru> <1433255230.1495.2.camel@twins> <20150602160724.GS18673@twins.programming.kicks-ass.net> <249151433262439@web6m.yandex.ru> <20150603073227.GW3644@twins.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Originating-IP: [10.30.16.109] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1812 Lines: 50 В Ср, 03/06/2015 в 09:32 +0200, Peter Zijlstra пишет: > On Tue, Jun 02, 2015 at 07:27:19PM +0300, Kirill Tkhai wrote: > > > + * task_dead_dl() will cancel our timer if we happen to die while > > > + * its still pending. > > > > task_dead_dl() is called for tasks of deadline class only. So if we do that, > > the timer may be executed after final task's dead. > > Indeed; sleep deprived brain misses the obvious :/ > > I can't seem to come up with anything much better than pulling that > hrtimer_cancel() into finish_task_switch(), however sad that is. Yeah, class-specific manipulation in generic function finish_task_switch() worsen modularity. I have an idea, but it require small hrtimer modification. We may use task_struct counters {get,put}_task_struct(), when we're starting or cancelling the timer, and in timer handler. But it require to return back the commit: commit 61699e13072a89880aa584dcc64c6da465fb2ccc Author: Thomas Gleixner Date: Tue Apr 14 21:09:23 2015 +0000 hrtimer: Remove hrtimer_start() return value because restart of the timer races with time handler. Also, it's not clearly for me if it's safe to do the final put_task_struct() from irq context and how it worsens life of RT people. > Something like: > > for_each_class(class) { > if (class->task_dead) > class->task_dead(prev); > } > > Would be nicest, but will slow down the common case. And a callback list > has the downside of having to preallocate entries for every task, > causing mostly pointless memory overhead. > > -- 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/