Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753689AbbFCIzm (ORCPT ); Wed, 3 Jun 2015 04:55:42 -0400 Received: from casper.infradead.org ([85.118.1.10]:34796 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752726AbbFCIze (ORCPT ); Wed, 3 Jun 2015 04:55:34 -0400 Date: Wed, 3 Jun 2015 10:55:27 +0200 From: Peter Zijlstra To: pang.xunlei@zte.com.cn Cc: juri.lelli@gmail.com, ktkhai@parallels.com, linux-kernel@vger.kernel.org, mingo@elte.hu, oleg@redhat.com, pang.xunlei@linaro.org, rostedt@goodmis.org, umgwanakikbuti@gmail.com Subject: Re: [RFC][PATCH 1/7] sched: Replace post_schedule with a balance callback list Message-ID: <20150603085527.GA3644@twins.programming.kicks-ass.net> References: <20150601135818.506080835@infradead.org> <20150601140839.630055365@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1408 Lines: 38 A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? On Wed, Jun 03, 2015 at 04:24:05PM +0800, pang.xunlei@zte.com.cn wrote: > Hi Peter, > > This may increase the overhead of schedule() a bit, as it will have > more work to do. How so? It replaces the post_schedule() muck and should not be more expensive than that. It will make sched_setscheduler() etc.. a little more expensive, but that doesn't matter, those are not critical things at all. > check_class_changed(): > if (prev_class->switched_from) > prev_class->switched_from(rq, p); > /* Possble rq->lock 'hole'. */ > p->sched_class->switched_to(rq, p); > > For above cases, why can't we just add a judgement in switched_to_fair() > as follows: > if (rq != task_rq(p)) > return; Because its too easy to get wrong. There have been many instances of bugs caused by this dropping of rq->lock. And sure you can patch it up, once you find it, but I would really rather prevent these things if at all possible. -- 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/