Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3236654rdh; Thu, 28 Sep 2023 06:35:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEiLrku2/6hSYaYVDEzfheqMjQk8LollrRlod4zmcf/e3IeAAFAM/ZQC6Di3M7CesEfD8ip X-Received: by 2002:a17:90b:358c:b0:278:fb87:43e3 with SMTP id mm12-20020a17090b358c00b00278fb8743e3mr1170191pjb.12.1695908135268; Thu, 28 Sep 2023 06:35:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695908135; cv=none; d=google.com; s=arc-20160816; b=PhaM95mjD+DQ8pYknjjJDoBk2J4Y6dudJnH8xPU9LVomnSjjTzCursaO4nSA9FKK3U NW2SPTUeZhspN15AldyNxEx5JO/V8GwO3pdvfHOoCB5dhROriebnPnJBr5urpYSCQ3Ho WF9OkEfnYhd3YnG/ZInW1iQ4PBYVgg+LwBUPj/z9GanWvMhB9vJkfwC95fVafyUR9CH4 L5LulkWOW3eonzNtpHIbrfzh49I2QKxKRSsHHqNwLZoHoBNKMENgcaNzXFLbOrGK81bD wqctXHsyxDSv78f9N6j9OyvIZg894jwRD/xUEJFIhw2C2mtOXgn//aISwcjxK1xcQ+/J 9zmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=h6YvlznqxvWuAukC+g68ihPuz53Yf7CKktPIwkut/8k=; fh=knJ+q/noIykACjThyyhC1ih0q0bzBDlo1EZVdtLD45U=; b=hc+lGhAq8CUWY0ufGNLG6JyZ+XZPl5iQ4FsNnz6HpCmYbt/O207H6pUVjjys6d/L6c 4oj9wklhko9TBcwlLeAaZSip7j28Vu0DVkgHShs7aX/hEVshO+MV5gtfJWGvD9Zze+lp tzGZp+bysWmIYoPbsahVF4HNIxRNpH66MKWw5oX3uJf5XMNqv7M/IgPjAX+UGpjTHo0s wKwrjKFRVy2b64UZEc0wuPUI/jO+c6xH7jeuP8jF0QIROBGC+C0SRe9R4NMB1D7SIk4i 3jUYJAbrP9PpaSjC14zrCUJvcQzoR93WBSlGVcZZ10QGWEKITnKjk4BN+J2DBvTWymVX BeoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=eiFvDFfA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id v15-20020a17090a898f00b00279140ac5b3si1264584pjn.143.2023.09.28.06.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 06:35:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=eiFvDFfA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 564DF8051A36; Thu, 28 Sep 2023 01:52:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231343AbjI1Iwj (ORCPT + 99 others); Thu, 28 Sep 2023 04:52:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230111AbjI1Iwf (ORCPT ); Thu, 28 Sep 2023 04:52:35 -0400 Received: from out-209.mta0.migadu.com (out-209.mta0.migadu.com [91.218.175.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DC64C0 for ; Thu, 28 Sep 2023 01:52:33 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1695891151; 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=h6YvlznqxvWuAukC+g68ihPuz53Yf7CKktPIwkut/8k=; b=eiFvDFfA5JNFYrfLCWGCoZ121EI+Wri1IWuiRsB9y4jyqQJuILccd8PYLglspXWY09GoQD Ne1gBqgFJGFkmcAk1Qw1RHq/2J1njJVpZuHaWcA2j667rvnKKHDjioDvfhpvT96E+73CgD Qbo9CffmU1FDI5V2P1zNEklI3++D9e0= Date: Thu, 28 Sep 2023 16:52:22 +0800 MIME-Version: 1.0 Subject: Re: [PATCH v2] sched/rt: move back to RT_GROUP_SCHED and rename it child Content-Language: en-US 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 References: <20230920140127.1671945-1-yajun.deng@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yajun Deng In-Reply-To: <20230920140127.1671945-1-yajun.deng@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 28 Sep 2023 01:52:55 -0700 (PDT) Hi, Steve, Kindly ping... Thank. On 2023/9/20 22:01, Yajun Deng wrote: > The member back in struct sched_rt_entity only related to RT_GROUP_SCHED, > it should not place out of RT_GROUP_SCHED, move back to RT_GROUP_SCHED > and rename it child. This would save a few bytes. > > Init child when parent isn't NULL in init_tg_rt_entry() and introduce > for_each_sched_rt_entity_reverse() to iterate rt_se from top to down. > > Signed-off-by: Yajun Deng > --- > v2: fix the "uninitialized symbol 'root'" warning > v1: https://lore.kernel.org/all/20230919035114.2364567-1-yajun.deng@linux.dev/ > --- > include/linux/sched.h | 2 +- > kernel/sched/rt.c | 25 ++++++++++++++++--------- > 2 files changed, 17 insertions(+), 10 deletions(-) > > diff --git a/include/linux/sched.h b/include/linux/sched.h > index 7fcf1b82cfa6..cd05f4bb6a26 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -594,8 +594,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 *child; > 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 0597ba0f85ff..473a21b76c62 100644 > --- a/kernel/sched/rt.c > +++ b/kernel/sched/rt.c > @@ -230,8 +230,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->child = rt_se; > + } > > rt_se->my_q = rt_rq; > rt_se->parent = parent; > @@ -564,6 +566,9 @@ static inline struct task_group *next_task_group(struct task_group *tg) > #define for_each_sched_rt_entity(rt_se) \ > for (; rt_se; rt_se = rt_se->parent) > > +#define for_each_sched_rt_entity_reverse(rt_se) \ > + for (; rt_se; rt_se = rt_se->child) > + > static inline struct rt_rq *group_rt_rq(struct sched_rt_entity *rt_se) > { > return rt_se->my_q; > @@ -669,6 +674,9 @@ typedef struct rt_rq *rt_rq_iter_t; > #define for_each_sched_rt_entity(rt_se) \ > for (; rt_se; rt_se = NULL) > > +#define for_each_sched_rt_entity_reverse(rt_se) \ > + for_each_sched_rt_entity(rt_se) > + > static inline struct rt_rq *group_rt_rq(struct sched_rt_entity *rt_se) > { > return NULL; > @@ -1481,22 +1489,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; > > - for (rt_se = back; rt_se; rt_se = rt_se->back) { > + rt_se = root; > + for_each_sched_rt_entity_reverse(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)