From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932850AbcBYOQD (ORCPT ); Thu, 25 Feb 2016 09:16:03 -0500 Received: from foss.arm.com ([217.140.101.70]:51813 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760665AbcBYOQA (ORCPT ); Thu, 25 Feb 2016 09:16:00 -0500 Date: Thu, 25 Feb 2016 14:16:59 +0000 From: Juri Lelli To: Peter Zijlstra Cc: luca abeni , linux-kernel@vger.kernel.org Subject: Re: Question about prio_changed_dl() Message-ID: <20160225141659.GB18792@e106622-lin> References: <20160219134345.70ff4aa0@utopia> <20160225140149.GK6357@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160225140149.GK6357@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/02/16 15:01, Peter Zijlstra wrote: > On Fri, Feb 19, 2016 at 01:43:45PM +0100, luca abeni wrote: > > Hi, > > > > when playing with the __dl_{add,sub}_ac() stuff recently posted by > > Juri, I found something that looks strange in prio_changed_dl(): > > > > static void prio_changed_dl(struct rq *rq, struct task_struct *p, > > int oldprio) > > { > > if (task_on_rq_queued(p) || rq->curr == p) { > > [...] > > } else > > switched_to_dl(rq, p); > > } > > but switched_to_dl() does: > > static void switched_to_dl(struct rq *rq, struct task_struct *p) > > { > > if (task_on_rq_queued(p) && rq->curr != p) { > > [...] > > } > > } > > > > so, prio_changed_dl() invokes switched_to_dl() if task_on_rq_queued() > > is false, but in this case switched_to_dl() does nothing... Am I > > missing something, or the > > } else > > switched_to_dl(rq, p); > > is useless? > > Agreed, see below. > > > (BTW, it seems to me that switched_to_dl() is never invoked, for some > > reason...) > > Hmm, it should be invoked if you do sched_setattr() to get > SCHED_DEADLINE. > > --- > Subject: sched/deadline: Remove superfluous call to switched_to_dl() > > if (A || B) { > > } else if (A && !B) { > > } > > If A we'll take the first branch, if !A we will not satisfy the second. > Therefore the second branch will never be taken. > > Cc: Juri Lelli > Reported-by: luca abeni > Signed-off-by: Peter Zijlstra (Intel) Indeed! Acked-by: Juri Lelli Thanks, - Juri