Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp14544lqr; Tue, 4 Jun 2024 18:52:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWzoyFPXgyjU205xAURGXsidGV19UChrwbi0FFA56JfdB+Rld+zJeiPNJhVsszcqZj940pVOdLZxZ1BxzYofcmdnLIrTUyeISuMbefcKA== X-Google-Smtp-Source: AGHT+IFYmhjNdcE1Us+71ZlvHg+6YH7vr/81AcQYtLfVN99JP+yjLqPZS7fC2V3GiQBfbtt2cE4D X-Received: by 2002:a05:6870:9210:b0:24c:a547:7b5a with SMTP id 586e51a60fabf-25122650734mr1374941fac.14.1717552336243; Tue, 04 Jun 2024 18:52:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717552336; cv=pass; d=google.com; s=arc-20160816; b=JLetWTwQw/Q0tZOwOsIth2kkqrh4Cfsk0Z/AGNahv75iDHctcX5K2FXLyGG0Gfz/LV dSKk4NNYHoiyMquCraVXSyLsIhxvhEu10bEt2GqVB2pzG+lJ+s1qgGHn3HDdKZvxUHYa dhacVS9gc74P+c9goplz33vknXRhIlkFo1a3pykf5EupUO727Vt7BIUchJXnag+Zoipx cdUGOivlP9bEZaqaysvlC8HdMQPRAV9RG/dfXkiVWoY5au+YzmIs4uTGjQ3Ae6v8Mh8Y /brBEpsJrlfIvIjK4CcdFRMleDGb69EvoUqsU8pv4Sa4hp0eyijb6SMGVdeTdO018KqI y9Qg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:cc:to:subject:tls-required:message-id:from :content-transfer-encoding:date:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=hUqGdjChfFePBEmzTvxgo/M+GEGY1EGXeb0w/Z5L5Bk=; fh=2cXVD5m/LqksxE8EowIhkjoFsWUitXZeO/JhAkaW1/8=; b=KmXAzA8AZHhKWwUFvxfD2F0Q3dBHZjRNAERx9Ma54M3zmNwCm9ILpyWvCU5lR9FsRv zcY9Acn/dy6oMXOd7fvm9Ywe21XSNBZWmbNkMIdfT+c8ULLKoTYRvIOQY8fMJqPnV3wS DR/lSTR4i4JhQb0XCDKC2Qhs1uD441xdHG3kRwiyIktUDRMKMZWN+Bv23/xttzr536qt LLUk+W8zlzo5fdKM0MDB1KOnRsXXWgPYkYwaruOP7M0YzTQBetZxxGDyCU/WIcsmNNLb S7WQK9mdz9+Z3A5vm7mSn7nLmSCRlD3DJbamYmLWZOhJRz6BKfUPvDdKFLltWW1h+NeW ueqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=MYapstne; 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-201658-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201658-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35c73bfa2si9014333a12.747.2024.06.04.18.52.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 18:52:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201658-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=MYapstne; 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-201658-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201658-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 34E83285A57 for ; Wed, 5 Jun 2024 01:52:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A5445577E; Wed, 5 Jun 2024 01:52:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="MYapstne" Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (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 2F54D41E22 for ; Wed, 5 Jun 2024 01:51:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717552323; cv=none; b=RGZC+/H6P2O1rfQbsG46hV/QgHK2Ej+gxy41/QPP5zwefdPH+ztSVIpLrQX9P6nJhf8IB4F0HREmtueTCbxjdPzt6YidzYJDwZA+wmUY0mGLbl8cxYE2I9d4W2QaQLf7jE3irtei+dUigchogdl9yPmnX0g0C0hCeLOm73Z2VI0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717552323; c=relaxed/simple; bh=tFstuWoiDFg9p/08Ftae3BF6Esh20l7dkxXpMlH7aeM=; h=MIME-Version:Date:Content-Type:From:Message-ID:Subject:To:Cc: In-Reply-To:References; b=IXZCtx7l66lMMmdWgMYuged7Yn9JNaU0Pgh451pufA2DhjhnbSjCEkDl0rnfrOgdj94RJSGGmojKlrmU1g5km/FwXCyxAtBc1RR+WqWRTNArBj6F/1iuj2MYo7Yii26Q1lNgYmMqr1kERBuZWtM4puBGOlBUcsGo5O5Rh7/Pw+o= 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=MYapstne; arc=none smtp.client-ip=95.215.58.173 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: rostedt@goodmis.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1717552317; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hUqGdjChfFePBEmzTvxgo/M+GEGY1EGXeb0w/Z5L5Bk=; b=MYapstneE6ipTNaTPdXA9F4FZHznwa/90mAqWVYKiuRXYiAPAdZN48zop/l2gdXKRROMwd lQVYqsVWjczNeft6tUPlGj6zTzC8QK+/UBwZ/lD9G26tNLmD9SB5zpKrTg2dhZMVHQkUZL qTfXn8zQo8qNcWoe6VIfBxjIpHCXAig= X-Envelope-To: mingo@redhat.com 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: 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Wed, 05 Jun 2024 01:51:56 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Yajun Deng" Message-ID: TLS-Required: No Subject: Re: [PATCH 1/2] sched/rt: Use 'back' only if CONFIG_RT_GROUP_SCHED is enabled To: "Steven Rostedt" Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, linux-kernel@vger.kernel.org In-Reply-To: <20240604092203.7c31b7b5@gandalf.local.home> References: <20240603125002.3086-1-yajun.deng@linux.dev> <20240603125002.3086-2-yajun.deng@linux.dev> <20240604092203.7c31b7b5@gandalf.local.home> X-Migadu-Flow: FLOW_OUT June 4, 2024 at 9:22 PM, "Steven Rostedt" wrote: >=20 >=20On Mon, 3 Jun 2024 20:50:01 +0800 >=20 >=20Yajun Deng wrote: >=20 >=20>=20 >=20> The 'back' member in struct sched_rt_entity only related to > >=20 >=20> CONFIG_RT_GROUP_SCHED, so there is no need to init it in dequeue_r= t_stack. > >=20 >=20>=20=20 >=20>=20 >=20> Init the 'back' member in init_tg_rt_entry and use it only if > >=20 >=20> CONFIG_RT_GROUP_SCHED is enabled. > >=20 >=20>=20=20 >=20>=20 >=20> Signed-off-by: Yajun Deng > >=20 >=20> --- > >=20 >=20> kernel/sched/rt.c | 15 ++++++++++----- > >=20 >=20> 1 file changed, 10 insertions(+), 5 deletions(-) > >=20 >=20>=20=20 >=20>=20 >=20> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c > >=20 >=20> index 63e49c8ffc4d..44bb9087cfe5 100644 > >=20 >=20> --- a/kernel/sched/rt.c > >=20 >=20> +++ b/kernel/sched/rt.c > >=20 >=20> @@ -232,8 +232,10 @@ void init_tg_rt_entry(struct task_group *tg, = struct rt_rq *rt_rq, > >=20 >=20>=20=20 >=20>=20 >=20> if (!parent) > >=20 >=20> rt_se->rt_rq =3D &rq->rt; > >=20 >=20> - else > >=20 >=20> + else { > >=20 >=20> rt_se->rt_rq =3D parent->my_q; > >=20 >=20> + parent->back =3D rt_se; > >=20 >=20> + } > >=20 >=20 > If one block of an if/else requires brackets, then both do. >=20 Got=20it. > >=20 >=20> rt_se->my_q =3D rt_rq; > >=20 >=20> rt_se->parent =3D parent; > >=20 >=20> @@ -1428,16 +1430,19 @@ static void dequeue_rt_stack(struct sched_= rt_entity *rt_se, unsigned int flags) > >=20 >=20> struct sched_rt_entity *back =3D NULL; > >=20 >=20> unsigned int rt_nr_running; > >=20 >=20>=20=20 >=20>=20 >=20> - for_each_sched_rt_entity(rt_se) { > >=20 >=20> - rt_se->back =3D back; > >=20 >=20> + for_each_sched_rt_entity(rt_se) > >=20 >=20> back =3D rt_se; > >=20 >=20> - } > >=20 >=20>=20=20 >=20>=20 >=20> rt_nr_running =3D rt_rq_of_se(back)->rt_nr_running; > >=20 >=20>=20=20 >=20>=20 >=20> - for (rt_se =3D back; rt_se; rt_se =3D rt_se->back) { > >=20 >=20> + for (rt_se =3D back; rt_se; ) { > >=20 >=20> if (on_rt_rq(rt_se)) > >=20 >=20> __dequeue_rt_entity(rt_se, flags); > >=20 >=20> +#ifdef CONFIG_RT_GROUP_SCHED > >=20 >=20> + rt_se =3D rt_se->back; > >=20 >=20> +#else > >=20 >=20> + rt_se =3D NULL; > >=20 >=20> +#endif > >=20 >=20 > Perhaps make a helper function to get rid of the #ifdef in the code her= e. >=20 >=20 for (rt_se =3D back, rt_se; rt_se =3D rt_se_back(rt_se)) { >=20 >=20Where rt_se_back() above can be defined in the #ifdef blocks for >=20 >=20CONFIG_RT_GROUP_SCHED as either: >=20 >=20static struct sched_rt_entity *rt_se_back(struct sched_rt_entity *se) >=20 >=20{ >=20 >=20 return se->back; >=20 >=20} >=20 >=20Or >=20 >=20static inline struct sched_rt_entity *rt_se_back(struct sched_rt_enti= ty *se) >=20 >=20{ >=20 >=20 return NULL; >=20 >=20} >=20 Okay,=20thanks. > -- Steve >=20 >=20>=20 >=20> } > >=20 >=20>=20=20 >=20>=20 >=20> dequeue_top_rt_rq(rt_rq_of_se(back), rt_nr_running); > > >