[2/2] sched/rt: Move sched_rt_entity::back to under the CONFIG_RT_GROUP_SCHED block
Message ID | 20231005162317.3343678-3-yajun.deng@linux.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp426508vqb; Thu, 5 Oct 2023 09:43:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElVTrenM8ln6J45bg4z52vphdNH19GYswtd16ZDUhDjnX6Er+IrCnJlSzVgQL/ISYJOsYS X-Received: by 2002:a05:6a21:1f16:b0:152:1ce8:ce3a with SMTP id ry22-20020a056a211f1600b001521ce8ce3amr4942522pzb.18.1696524189940; Thu, 05 Oct 2023 09:43:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696524189; cv=none; d=google.com; s=arc-20160816; b=lWCRVSd3IgQyVONs/fOS3WNi3r9h0dfqlGQL8G00B2N1qzhYic4X5eoN5/XspMHkgr 0PS7Nh4y1f44r1zfXIidXmHjIezudTC5pHZIn/bjc7v0npNodENn4O9n7MiMInzFWP4H L8kkwD6MYQxybR4sAmAnkGYyEZlodMaOQbL1CxbeCuK3XdBkkM2OILTIFnjYvLuP9ddz +116nLAv+clP8bW1xNkZkuAgR3v40Vw3r/8t7l7LSxM5uD00onnuY2Gznf5dleyZ1dck XAQnpr/jZJIkViVUmUW1U8wyF77cpfjw8UQwu+9NxpA3qBjnr5ejWaIeSo4v4Kdm1Exv vLGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zmy3zotbQnnCKFfAnZbO+ZCxlJAV6ZCKqlKvYGPQcy8=; fh=kY5sJNvn29qhEh2SatEVpXE2cTkcQ8AnU+xu9Bnn8Ic=; b=NF9/KXbkiQ7IKQAoExCviD5UDoBjO2/BA5gvRFNQue94RhPMtCX8t8h16kQ64uZokN GHyTrEMpDhjWCgJnq0/6XG/FNWvoLVNP7TVmfb3/4L6r53r599gh+6HZO7DH0kSwvrC2 SxZTtrV7EAtIW+ZpPcTZLjR8iwuzKax3o3sp9XM45GJ2iTyNrf7agyo3zJlU2mgLBkcb KINWKVG3OhXhqP/5lLnqtmXhqJIFzOzvpJYesGHHVXVp3EZpsYeKe+lsE738fB2ubZzd e1vl+NWCDzhza48JKNsupoiUIZ0GE1QiVkNUBowkCsDlADudI63Z5o6l2tYVjdXFFxP8 /hYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=uWRFSMTp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id d11-20020a170902cecb00b001c5ff477ebcsi882166plg.265.2023.10.05.09.43.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 09:43:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=uWRFSMTp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 4A95D808984E; Thu, 5 Oct 2023 09:42:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234238AbjJEQlN (ORCPT <rfc822;ezelljr.billy@gmail.com> + 18 others); Thu, 5 Oct 2023 12:41:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235333AbjJEQj2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 5 Oct 2023 12:39:28 -0400 Received: from out-200.mta1.migadu.com (out-200.mta1.migadu.com [95.215.58.200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 102B5423E for <linux-kernel@vger.kernel.org>; Thu, 5 Oct 2023 09:23:56 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1696523034; 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=zmy3zotbQnnCKFfAnZbO+ZCxlJAV6ZCKqlKvYGPQcy8=; b=uWRFSMTpGCh/IZ4iyBdzbqhocEbshB6NFx99HW+hW/gm+4qaBNsz0rz6z/VRftvSFDBJN4 GbADw37GROFpcUjH7WRyft3BbeYpDlxBNKllHNvbErj4W5XEh1QXiZ2TGj4eFy3cuz/vJ7 Ins8jYuTOTrhvR+yn1fQ09yCB2JDHMM= From: Yajun Deng <yajun.deng@linux.dev> 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 <yajun.deng@linux.dev> Subject: [PATCH 2/2] sched/rt: Move sched_rt_entity::back to under the CONFIG_RT_GROUP_SCHED block Date: Fri, 6 Oct 2023 00:23:17 +0800 Message-Id: <20231005162317.3343678-3-yajun.deng@linux.dev> In-Reply-To: <20231005162317.3343678-1-yajun.deng@linux.dev> References: <20231005162317.3343678-1-yajun.deng@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 05 Oct 2023 09:42:40 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778934548973268136 X-GMAIL-MSGID: 1778934548973268136 |
Series |
Move sched_rt_entity::back to RT_GROUP_SCHED
|
|
Commit Message
Yajun Deng
Oct. 5, 2023, 4:23 p.m. UTC
The member back in struct sched_rt_entity only related to RT_GROUP_SCHED,
So move sched_rt_entity::back to under the CONFIG_RT_GROUP_SCHED block. It
will save a few bytes.
Also, init child when parent isn't NULL in init_tg_rt_entry().
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
include/linux/sched.h | 2 +-
kernel/sched/rt.c | 18 +++++++++---------
2 files changed, 10 insertions(+), 10 deletions(-)
Comments
* Yajun Deng <yajun.deng@linux.dev> wrote: > The member back in struct sched_rt_entity only related to RT_GROUP_SCHED, > So move sched_rt_entity::back to under the CONFIG_RT_GROUP_SCHED block. It > will save a few bytes. > > Also, init child when parent isn't NULL in init_tg_rt_entry(). > > Signed-off-by: Yajun Deng <yajun.deng@linux.dev> > --- > include/linux/sched.h | 2 +- > kernel/sched/rt.c | 18 +++++++++--------- > 2 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/include/linux/sched.h b/include/linux/sched.h > index 292c31697248..d0fe56603e60 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -597,8 +597,8 @@ struct sched_rt_entity { > unsigned short on_rq; > unsigned short on_list; > > - struct sched_rt_entity *back; > #ifdef CONFIG_RT_GROUP_SCHED > + struct sched_rt_entity *back; > struct sched_rt_entity *parent; > /* rq on which this entity is (to be) queued: */ > struct rt_rq *rt_rq; Title claims this change - the rest of the changes should be in a separate patch: > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c > index 642edbd24ffb..7b3105b875f1 100644 > --- a/kernel/sched/rt.c > +++ b/kernel/sched/rt.c > @@ -233,8 +233,10 @@ void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq, > > 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; > @@ -1441,23 +1443,21 @@ static void __dequeue_rt_entity(struct sched_rt_entity *rt_se, unsigned int flag > */ > static void dequeue_rt_stack(struct sched_rt_entity *rt_se, unsigned int flags) > { > - struct sched_rt_entity *back = NULL; > + struct sched_rt_entity *root = NULL; > unsigned int rt_nr_running; > > - for_each_sched_rt_entity(rt_se) { > - rt_se->back = back; > - back = rt_se; > - } > + for_each_sched_rt_entity(rt_se) > + root = rt_se; > > - rt_nr_running = rt_rq_of_se(back)->rt_nr_running; > + rt_nr_running = rt_rq_of_se(root)->rt_nr_running; > > - rt_se = back; > + rt_se = root; > for_each_sched_rt_entity_back(rt_se) { > if (on_rt_rq(rt_se)) > __dequeue_rt_entity(rt_se, flags); > } > > - dequeue_top_rt_rq(rt_rq_of_se(back), rt_nr_running); > + dequeue_top_rt_rq(rt_rq_of_se(root), rt_nr_running); > } > > static void enqueue_rt_entity(struct sched_rt_entity *rt_se, unsigned int flags) > -- > 2.25.1 Thanks, Ingo
On 2023/10/9 18:16, Ingo Molnar wrote: > * Yajun Deng <yajun.deng@linux.dev> wrote: > >> The member back in struct sched_rt_entity only related to RT_GROUP_SCHED, >> So move sched_rt_entity::back to under the CONFIG_RT_GROUP_SCHED block. It >> will save a few bytes. >> >> Also, init child when parent isn't NULL in init_tg_rt_entry(). >> >> Signed-off-by: Yajun Deng <yajun.deng@linux.dev> >> --- >> include/linux/sched.h | 2 +- >> kernel/sched/rt.c | 18 +++++++++--------- >> 2 files changed, 10 insertions(+), 10 deletions(-) >> >> diff --git a/include/linux/sched.h b/include/linux/sched.h >> index 292c31697248..d0fe56603e60 100644 >> --- a/include/linux/sched.h >> +++ b/include/linux/sched.h >> @@ -597,8 +597,8 @@ struct sched_rt_entity { >> unsigned short on_rq; >> unsigned short on_list; >> >> - struct sched_rt_entity *back; >> #ifdef CONFIG_RT_GROUP_SCHED >> + struct sched_rt_entity *back; >> struct sched_rt_entity *parent; >> /* rq on which this entity is (to be) queued: */ >> struct rt_rq *rt_rq; > Title claims this change - the rest of the changes should be in a separate > patch: Okay. I will send v2. >> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c >> index 642edbd24ffb..7b3105b875f1 100644 >> --- a/kernel/sched/rt.c >> +++ b/kernel/sched/rt.c >> @@ -233,8 +233,10 @@ void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq, >> >> 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; >> @@ -1441,23 +1443,21 @@ static void __dequeue_rt_entity(struct sched_rt_entity *rt_se, unsigned int flag >> */ >> static void dequeue_rt_stack(struct sched_rt_entity *rt_se, unsigned int flags) >> { >> - struct sched_rt_entity *back = NULL; >> + struct sched_rt_entity *root = NULL; >> unsigned int rt_nr_running; >> >> - for_each_sched_rt_entity(rt_se) { >> - rt_se->back = back; >> - back = rt_se; >> - } >> + for_each_sched_rt_entity(rt_se) >> + root = rt_se; >> >> - rt_nr_running = rt_rq_of_se(back)->rt_nr_running; >> + rt_nr_running = rt_rq_of_se(root)->rt_nr_running; >> >> - rt_se = back; >> + rt_se = root; >> for_each_sched_rt_entity_back(rt_se) { >> if (on_rt_rq(rt_se)) >> __dequeue_rt_entity(rt_se, flags); >> } >> >> - dequeue_top_rt_rq(rt_rq_of_se(back), rt_nr_running); >> + dequeue_top_rt_rq(rt_rq_of_se(root), rt_nr_running); >> } >> >> static void enqueue_rt_entity(struct sched_rt_entity *rt_se, unsigned int flags) >> -- >> 2.25.1 > Thanks, > > Ingo
* Yajun Deng <yajun.deng@linux.dev> wrote: > > On 2023/10/9 18:16, Ingo Molnar wrote: > > * Yajun Deng <yajun.deng@linux.dev> wrote: > > > > > The member back in struct sched_rt_entity only related to RT_GROUP_SCHED, > > > So move sched_rt_entity::back to under the CONFIG_RT_GROUP_SCHED block. It > > > will save a few bytes. > > > > > > Also, init child when parent isn't NULL in init_tg_rt_entry(). > > > > > > Signed-off-by: Yajun Deng <yajun.deng@linux.dev> > > > --- > > > include/linux/sched.h | 2 +- > > > kernel/sched/rt.c | 18 +++++++++--------- > > > 2 files changed, 10 insertions(+), 10 deletions(-) > > > > > > diff --git a/include/linux/sched.h b/include/linux/sched.h > > > index 292c31697248..d0fe56603e60 100644 > > > --- a/include/linux/sched.h > > > +++ b/include/linux/sched.h > > > @@ -597,8 +597,8 @@ struct sched_rt_entity { > > > unsigned short on_rq; > > > unsigned short on_list; > > > - struct sched_rt_entity *back; > > > #ifdef CONFIG_RT_GROUP_SCHED > > > + struct sched_rt_entity *back; > > > struct sched_rt_entity *parent; > > > /* rq on which this entity is (to be) queued: */ > > > struct rt_rq *rt_rq; > > Title claims this change - the rest of the changes should be in a separate > > patch: > > > Okay. I will send v2. It's ~v7 already by my count, isn't it? Thanks, Ingo
On 2023/10/9 19:26, Ingo Molnar wrote: > * Yajun Deng <yajun.deng@linux.dev> wrote: > >> On 2023/10/9 18:16, Ingo Molnar wrote: >>> * Yajun Deng <yajun.deng@linux.dev> wrote: >>> >>>> The member back in struct sched_rt_entity only related to RT_GROUP_SCHED, >>>> So move sched_rt_entity::back to under the CONFIG_RT_GROUP_SCHED block. It >>>> will save a few bytes. >>>> >>>> Also, init child when parent isn't NULL in init_tg_rt_entry(). >>>> >>>> Signed-off-by: Yajun Deng <yajun.deng@linux.dev> >>>> --- >>>> include/linux/sched.h | 2 +- >>>> kernel/sched/rt.c | 18 +++++++++--------- >>>> 2 files changed, 10 insertions(+), 10 deletions(-) >>>> >>>> diff --git a/include/linux/sched.h b/include/linux/sched.h >>>> index 292c31697248..d0fe56603e60 100644 >>>> --- a/include/linux/sched.h >>>> +++ b/include/linux/sched.h >>>> @@ -597,8 +597,8 @@ struct sched_rt_entity { >>>> unsigned short on_rq; >>>> unsigned short on_list; >>>> - struct sched_rt_entity *back; >>>> #ifdef CONFIG_RT_GROUP_SCHED >>>> + struct sched_rt_entity *back; >>>> struct sched_rt_entity *parent; >>>> /* rq on which this entity is (to be) queued: */ >>>> struct rt_rq *rt_rq; >>> Title claims this change - the rest of the changes should be in a separate >>> patch: >> >> Okay. I will send v2. > It's ~v7 already by my count, isn't it? May be. If we count from the earliest. > > Thanks, > > Ingo
* Yajun Deng <yajun.deng@linux.dev> wrote: > > On 2023/10/9 19:26, Ingo Molnar wrote: > > * Yajun Deng <yajun.deng@linux.dev> wrote: > > > > > On 2023/10/9 18:16, Ingo Molnar wrote: > > > > * Yajun Deng <yajun.deng@linux.dev> wrote: > > > > > > > > > The member back in struct sched_rt_entity only related to RT_GROUP_SCHED, > > > > > So move sched_rt_entity::back to under the CONFIG_RT_GROUP_SCHED block. It > > > > > will save a few bytes. > > > > > > > > > > Also, init child when parent isn't NULL in init_tg_rt_entry(). > > > > > > > > > > Signed-off-by: Yajun Deng <yajun.deng@linux.dev> > > > > > --- > > > > > include/linux/sched.h | 2 +- > > > > > kernel/sched/rt.c | 18 +++++++++--------- > > > > > 2 files changed, 10 insertions(+), 10 deletions(-) > > > > > > > > > > diff --git a/include/linux/sched.h b/include/linux/sched.h > > > > > index 292c31697248..d0fe56603e60 100644 > > > > > --- a/include/linux/sched.h > > > > > +++ b/include/linux/sched.h > > > > > @@ -597,8 +597,8 @@ struct sched_rt_entity { > > > > > unsigned short on_rq; > > > > > unsigned short on_list; > > > > > - struct sched_rt_entity *back; > > > > > #ifdef CONFIG_RT_GROUP_SCHED > > > > > + struct sched_rt_entity *back; > > > > > struct sched_rt_entity *parent; > > > > > /* rq on which this entity is (to be) queued: */ > > > > > struct rt_rq *rt_rq; > > > > Title claims this change - the rest of the changes should be in a separate > > > > patch: > > > > > > Okay. I will send v2. > > It's ~v7 already by my count, isn't it? > > > May be. If we count from the earliest. Yes, of course we count from the earliest this series was sent, why wouldn't we? Having new patches or removing patches doesn't really reset the counter. Thanks, Ingo
diff --git a/include/linux/sched.h b/include/linux/sched.h index 292c31697248..d0fe56603e60 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -597,8 +597,8 @@ struct sched_rt_entity { unsigned short on_rq; unsigned short on_list; - struct sched_rt_entity *back; #ifdef CONFIG_RT_GROUP_SCHED + struct sched_rt_entity *back; struct sched_rt_entity *parent; /* rq on which this entity is (to be) queued: */ struct rt_rq *rt_rq; diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 642edbd24ffb..7b3105b875f1 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -233,8 +233,10 @@ void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq, 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; @@ -1441,23 +1443,21 @@ static void __dequeue_rt_entity(struct sched_rt_entity *rt_se, unsigned int flag */ static void dequeue_rt_stack(struct sched_rt_entity *rt_se, unsigned int flags) { - struct sched_rt_entity *back = NULL; + struct sched_rt_entity *root = NULL; unsigned int rt_nr_running; - for_each_sched_rt_entity(rt_se) { - rt_se->back = back; - back = rt_se; - } + for_each_sched_rt_entity(rt_se) + root = rt_se; - rt_nr_running = rt_rq_of_se(back)->rt_nr_running; + rt_nr_running = rt_rq_of_se(root)->rt_nr_running; - rt_se = back; + rt_se = root; for_each_sched_rt_entity_back(rt_se) { if (on_rt_rq(rt_se)) __dequeue_rt_entity(rt_se, flags); } - dequeue_top_rt_rq(rt_rq_of_se(back), rt_nr_running); + dequeue_top_rt_rq(rt_rq_of_se(root), rt_nr_running); } static void enqueue_rt_entity(struct sched_rt_entity *rt_se, unsigned int flags)