From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E2571D9A5F for ; Tue, 5 May 2026 13:16:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777987000; cv=none; b=Uqq49ruGU5y+cDyQgiTzSc3dy/pLpq+crI9AgIiWtuhV+HiU7XKkTmfXilb2Js6N9L3z+PJIhpPd6IsP7Iy95gxJkaUh4Ypjhiy2hbqEJEJ0ZvlbZmZ57UfRzX8KMfmcgDCBkPHHS1tt8R6WGDoHBnsi2TVEEl/pmKs++gC7OmY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777987000; c=relaxed/simple; bh=lUlWi7G74clkuOiFUaArMHTuN02jrf4bDUyubVttfOc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FAjUtDrQStPfkyx9orFhqLSG1h2Qyx9BQsIE+P0KPvNpg1r3s9ZgMtjAFXFhJLWy43At3Oh89GWFvoMQEYhCIqNSH6f4PK3u1BuPF2AvoVanhOH7+ijX0Orxe2/D2tCQR2ReJC4eFyfSlAH12YEDkpqOHke40ZoLMevCWkdvX94= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=B+Hno1ub; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="B+Hno1ub" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=K68JEpZoPYzMYif9T4lLt2dxtUybZNorA03AgGCrtf8=; b=B+Hno1ubY0jGGjHW/W8g/zlK/Z /B5xWmCHBoKuyZ257Zqyzr4CY+7jkN8Y9hAp1QhjYCRcWzxbS0wic3OL81dV+pFtHhrZoNf05XdLb lpFjU9qceo5Q0CT7ls5McYVlLGt2Otyqqq9GxdG1UBF6EHufD6VnjuBjQrAHUwpwXx8kwZiO5NE0h FMH/i2Rik3VmyJEMaO3W7hS76tBK40yDZIOoLxPr40BkzUlKCzOUD+LF9zgRmBw5f7GEwsmD5tx9c i84sI1RZ9kGqU4rfr27oLIiUakaLIRK81pPY+vSplZDxkEqTKJKrthkfgsXX1QXy+RzX1MPB2Eu+I Pk80dVag==; Received: from 2001-1c00-8d85-4b00-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d85:4b00:266e:96ff:fe07:7dcc] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1wKFdW-00000002o4T-0UKN; Tue, 05 May 2026 13:16:30 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 4C2C73001AC; Tue, 05 May 2026 15:16:28 +0200 (CEST) Date: Tue, 5 May 2026 15:16:28 +0200 From: Peter Zijlstra To: Yuri Andriaccio Cc: Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , linux-kernel@vger.kernel.org, Luca Abeni , Yuri Andriaccio Subject: Re: [RFC PATCH v5 14/29] sched/rt: Update task event callbacks for HCBS scheduling Message-ID: <20260505131628.GN1026330@noisy.programming.kicks-ass.net> References: <20260430213835.62217-1-yurand2000@gmail.com> <20260430213835.62217-15-yurand2000@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260430213835.62217-15-yurand2000@gmail.com> On Thu, Apr 30, 2026 at 11:38:18PM +0200, Yuri Andriaccio wrote: > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c > index defb812b0e48..67fbf4bbe461 100644 > --- a/kernel/sched/rt.c > +++ b/kernel/sched/rt.c > @@ -975,7 +975,58 @@ static int balance_rt(struct rq *rq, struct task_struct *p, struct rq_flags *rf) > static void wakeup_preempt_rt(struct rq *rq, struct task_struct *p, int flags) > { > struct task_struct *donor = rq->donor; > + struct sched_dl_entity *woken_dl_se = NULL; > + struct sched_dl_entity *donor_dl_se = NULL; > + > + if (!rt_group_sched_enabled()) > + goto no_group_sched; > > + /* > + * Preemption checks are different if the waking task and the current task > + * are running on the global runqueue or in a cgroup. The following rules > + * apply: > + * - dl-tasks (and equally dl_servers) always preempt FIFO/RR tasks. > + * - if curr is a FIFO/RR task inside a cgroup (i.e. run by a > + * dl_server), or curr is a DEADLINE task and waking is a FIFO/RR task > + * on the root cgroup, do nothing. > + * - if waking is inside a cgroup but curr is a FIFO/RR task in the root > + * cgroup, always reschedule. > + * - if they are both on the global runqueue, run the standard code. > + * - if they are both in the same cgroup, check for tasks priorities. > + * - if they are both in a cgroup, but not the same one, check whether the > + * woken task's dl_server preempts the current's dl_server. > + * - if curr is a DEADLINE task and waking is in a cgroup, check whether > + * the woken task's server preempts curr. > + */ > + if (is_dl_group(rt_rq_of_se(&p->rt))) > + woken_dl_se = dl_group_of(rt_rq_of_se(&p->rt)); > + if (is_dl_group(rt_rq_of_se(&donor->rt))) > + donor_dl_se = dl_group_of(rt_rq_of_se(&donor->rt)); > + else if (task_has_dl_policy(donor)) > + donor_dl_se = &donor->dl; > + > + if (woken_dl_se != NULL && donor_dl_se != NULL) { > + if (woken_dl_se == donor_dl_se) { > + if (p->prio < donor->prio) > + resched_curr(rq); > + > + return; This is effectively the traditional test, why not goto no_group_sched at this point and share that code rather than duplicate? > + } > + > + if (dl_entity_preempt(woken_dl_se, donor_dl_se)) > + resched_curr(rq); > + > + return; > + > + } else if (woken_dl_se != NULL) { > + resched_curr(rq); > + return; > + > + } else if (donor_dl_se != NULL) { > + return; > + } > + > +no_group_sched: > /* > * XXX If we're preempted by DL, queue a push? > */