Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp308116lqr; Wed, 5 Jun 2024 06:50:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXCZ/GCJWEJ/BuO3Odh4MhK4MVHwAnw6iyA796jalBkto3XvbceBMTdUUZxN3ICVpxYLw9s75AgZLUZz4kJ7Z+fMQ2RuOoPlGkHc3sfVQ== X-Google-Smtp-Source: AGHT+IGTNxAfs6ZRN1JxI3w4eF3ao74aKL5EMmpVxvcqd/C9grJBmcD9CFYfrDNTKFUYKLo+roQO X-Received: by 2002:a50:d497:0:b0:578:6198:d6ff with SMTP id 4fb4d7f45d1cf-57a8bca263cmr1768922a12.33.1717595433094; Wed, 05 Jun 2024 06:50:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717595433; cv=pass; d=google.com; s=arc-20160816; b=rS//22vesDIimZzLuQHOcQXGMyuTJZC8x6TPqQldmYyA1bIz6JFihbMpDCREQ2EkdQ aBiRUb0U1FHbYScQjpH4/IEeWKY7NwKEicjyaiN7mEPqOWbvTEaHRzFbBEADA6w1Izje BCqOgqlp/Fz6/LpGrdSsqw4Gmrs2vEYkq5w8ecF4f9JbzPSdtzTs3kXLu0JUTbzH606K alc+XOB0kBwhoPUOqAE+q3A+SRGRpEoRg7h9aKvM+goVsiGirSeSgys97k2eeMWI2Qho BWWwMiiIfAlmzW9M865438v2u3Qy0ozxmlnF5knOYpxwP7dpwybcze4ejugBqQ+E/xJT WtiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=8yb3nN64g5IVJqtCKRjk27NnlVJOOQo5LzCqk+WIDbk=; fh=kY5sJNvn29qhEh2SatEVpXE2cTkcQ8AnU+xu9Bnn8Ic=; b=P3fydWSYDoJoh9SuRi35JjUQX2FEh2QAW4kvokMwcxYt6AGzQFHlbbnFx2uy11fNl5 0ffUtcJCUFU90Cb9Q3CPdzwVZZ6AOunuoqkrytsR+f2P/MwvC0rgOE85TUp3Ye7hzbwA dCG30oOvkMRkmvJ/HrDRwsbH8hv6myCQn5CPiT9yTMdeUYlR0Xv1/wYmQ5LrFt7X3A2l tGI9GYrRqeJ1A4DUZ9wE1Z+l8tcr/akBqkrc9k0kLp23fSiGWRzC5XjjGY6zAe+511j8 41uK6C6QGujyTIbDUQY327Cf0XiVErNpNxgit/gb69CT9ck65iq3WEc+NtXGhZX+0Xwk LbJw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=UfXa0Mgm; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-202716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a68140d14si2819565a12.291.2024.06.05.06.50.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:50:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=UfXa0Mgm; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-202716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E82E51F2876C for ; Wed, 5 Jun 2024 13:48:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 06A6019B58E; Wed, 5 Jun 2024 13:36:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="UfXa0Mgm" Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (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 3DF3119AD7A for ; Wed, 5 Jun 2024 13:36:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717594591; cv=none; b=K2sTj0w0k5CSh646wggchODVkZ+uoih6wglGh473dP3uM373kdhNTcKtwJu64rpi6IRwHb6uJVmrnUpPtxO+3ohSlwZWCy/wtsEumLufeaO7f3liFfxpGIvYEkT63s/LnAhcnmZT5drXIZeb17WqhPBWPii5sXmD8ef1o6CTlro= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717594591; c=relaxed/simple; bh=Q+yKb3UoyyFzRRfAW+NzEGFhCqBmF4Gfe38PmpDlfNw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mSE12aZUQ84MUe5C31jU0nBSzq4hMC9vo/QVef5fy+BOO89wrY6h2MLAPdQ2ioLpwqtoD9B7oKEuw5XBhJUePrkknUhbXQdw1Fv9qsAYIrYaO2Ku2TrVnjOwfCR+Fwu2cUJfxOtARsxH9wo9tCUFl2zEldurMgD/nZcAcn5/UwY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=UfXa0Mgm; arc=none smtp.client-ip=95.215.58.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: mingo@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1717594586; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8yb3nN64g5IVJqtCKRjk27NnlVJOOQo5LzCqk+WIDbk=; b=UfXa0MgmXPfC5cQp4mFTQ5w4AnRjbsA95G4WA0FZbE5DR+O6chpusfCAqAbL+FuZb47rOc zpLXONsIfCQG0Klze82g5vLHVwrSOew/FU/9O5wgq2N8rZop34kYzbd36xHwEyAN7NpoBx H0w0IY0ARwcIbyTWWaIo4gSGEOgO0x0= X-Envelope-To: peterz@infradead.org X-Envelope-To: juri.lelli@redhat.com X-Envelope-To: vincent.guittot@linaro.org X-Envelope-To: dietmar.eggemann@arm.com X-Envelope-To: rostedt@goodmis.org X-Envelope-To: bsegall@google.com X-Envelope-To: mgorman@suse.de X-Envelope-To: bristot@redhat.com X-Envelope-To: vschneid@redhat.com X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: yajun.deng@linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yajun Deng To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com Cc: linux-kernel@vger.kernel.org, Yajun Deng Subject: [PATCH v2 1/2] sched/rt: Use 'back' only if CONFIG_RT_GROUP_SCHED is enabled Date: Wed, 5 Jun 2024 21:35:56 +0800 Message-Id: <20240605133557.2984-2-yajun.deng@linux.dev> In-Reply-To: <20240605133557.2984-1-yajun.deng@linux.dev> References: <20240605133557.2984-1-yajun.deng@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT The 'back' member in struct sched_rt_entity only related to CONFIG_RT_GROUP_SCHED, so there is no need to init it in dequeue_rt_stack. Init the 'back' member in init_tg_rt_entry and use it only if CONFIG_RT_GROUP_SCHED is enabled. Signed-off-by: Yajun Deng --- kernel/sched/rt.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 63e49c8ffc4d..842a2cfd6dcc 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -230,10 +230,12 @@ void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq, if (!rt_se) return; - if (!parent) + if (!parent) { rt_se->rt_rq = &rq->rt; - else + } else { rt_se->rt_rq = parent->my_q; + parent->back = rt_se; + } rt_se->my_q = rt_rq; rt_se->parent = parent; @@ -604,6 +606,11 @@ static inline struct rt_bandwidth *sched_rt_bandwidth(struct rt_rq *rt_rq) return &rt_rq->tg->rt_bandwidth; } +static struct sched_rt_entity *rt_se_back(struct sched_rt_entity *se) +{ + return se->back; +} + #else /* !CONFIG_RT_GROUP_SCHED */ static inline u64 sched_rt_runtime(struct rt_rq *rt_rq) @@ -666,6 +673,11 @@ static inline struct rt_bandwidth *sched_rt_bandwidth(struct rt_rq *rt_rq) return &def_rt_bandwidth; } +static inline struct sched_rt_entity *rt_se_back(struct sched_rt_entity *se) +{ + return NULL; +} + #endif /* CONFIG_RT_GROUP_SCHED */ bool sched_rt_bandwidth_account(struct rt_rq *rt_rq) @@ -1428,14 +1440,12 @@ static void dequeue_rt_stack(struct sched_rt_entity *rt_se, unsigned int flags) struct sched_rt_entity *back = NULL; unsigned int rt_nr_running; - for_each_sched_rt_entity(rt_se) { - rt_se->back = back; + for_each_sched_rt_entity(rt_se) back = rt_se; - } rt_nr_running = rt_rq_of_se(back)->rt_nr_running; - for (rt_se = back; rt_se; rt_se = rt_se->back) { + for (rt_se = back; rt_se; rt_se = rt_se_back(rt_se)) { if (on_rt_rq(rt_se)) __dequeue_rt_entity(rt_se, flags); } -- 2.25.1