From patchwork Thu Oct 5 16:23:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yajun Deng X-Patchwork-Id: 148914 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp427364vqb; Thu, 5 Oct 2023 09:44:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+9WUjO3NzGYIDENsgVDSiho4rhRvd2x7kLj0kFBWg5a1tJb1fWayUS751ITCTyv3tHstT X-Received: by 2002:a17:903:452:b0:1c5:cebd:ee83 with SMTP id iw18-20020a170903045200b001c5cebdee83mr5120290plb.54.1696524282798; Thu, 05 Oct 2023 09:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696524282; cv=none; d=google.com; s=arc-20160816; b=gUAU9Qi3KdF4MVf+j7p3OZjoLO42JHyGPL7U5j/FZ3Sl1YWubVHZMPponC4+bdjVcw UDtFjsZ2ZHPp7lJ+qVsSRSPSyryNUZN6CFfl/19c1Z3585C1DfMj9qOPxx0teBbBXr+y 01jJmzyNfk53iw2N1bRZlqMhAk9m4BMZZp4NzHqWLEZOIX24f+kHDoLbdcCeADAPO3BV 3dePRpb3DMqSZveMUUh4Dd5Sgkjg6VNqvIge4QqjKnfm+L1FL+LXGqvcWYhcBOhyUHDQ k09Eok7wpwkGox8lNr5KtckxN+MrJHxTpFCroMeEKq5QdghEqXaJysROyfFJCH3tOYzn NjGA== 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=VZoYSvv9GvN5UHY+p4M//aUHzUNjo8VNCPzwQbM0o+g=; fh=kY5sJNvn29qhEh2SatEVpXE2cTkcQ8AnU+xu9Bnn8Ic=; b=aW6pljuRjgs6Vcm1UU2IE/OIcZYMM/1khUZRyI8j0F995z2Zbs4woCx1/8A1vAFbMH uMy1o00/e+TQauN0Uwp5jodqKDCk6t/YpjLH6VnhNj39w1N0pEs0inf/4CiB9nYbZYB/ kGpg2BnHrpbcLhtwA0ltwT2PE9uK6q8NN/Gm45Ly6tl4MziWj36tDWqmvMCq47w84Ba1 k70flzsdgO+zG6Ab8gnuyI24aummfNiT0XshjOh0G99QiC5vpY11eTtsALq16Xo4yvP7 I/bXGWII+ioC4yM3Ayr/CIdYoekOBSpKbtkzUBJPcNE2S99vjjb4jvtVSYaVH5qSQgZI ZeSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=df+BZIZp; 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 f6-20020a17090274c600b001c60d6a620bsi1807419plt.95.2023.10.05.09.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 09:44:42 -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=df+BZIZp; 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 939A88050004; Thu, 5 Oct 2023 09:44:11 -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 S230508AbjJEQl0 (ORCPT + 18 others); Thu, 5 Oct 2023 12:41:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232276AbjJEQjz (ORCPT ); Thu, 5 Oct 2023 12:39:55 -0400 Received: from out-199.mta1.migadu.com (out-199.mta1.migadu.com [IPv6:2001:41d0:203:375::c7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 795683C12 for ; Thu, 5 Oct 2023 09:23:48 -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=1696523026; 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=VZoYSvv9GvN5UHY+p4M//aUHzUNjo8VNCPzwQbM0o+g=; b=df+BZIZp5gHbC2gFVu1urFRrQbixm+oQ8XGJpBLy22KE76hM96wBIBF65ACJdGioBWNUHH KJs0hEEvqnGkODXvq32oy4IFH+E1KU6Rx3MlmM/b7GyScsGRjbUqiK5vbvX//8l24v8E2e 8UTHaunkIzBGFncdDYoP7vyLkUJy0yU= 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 1/2] sched/rt: Introduce for_each_sched_rt_entity_back() & use it Date: Fri, 6 Oct 2023 00:23:16 +0800 Message-Id: <20231005162317.3343678-2-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 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: 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:44:11 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778934646207988465 X-GMAIL-MSGID: 1778934646207988465 The member back in struct sched_rt_entity only related to RT_GROUP_SCHED, it should not place out of RT_GROUP_SCHED. Introduce for_each_sched_rt_entity_back() & use it, it safe move back to under the CONFIG_RT_GROUP_SCHED in next patch. No functional changes. Signed-off-by: Yajun Deng --- kernel/sched/rt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 88fc98601413..642edbd24ffb 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -520,6 +520,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_back(rt_se) \ + for (; rt_se; rt_se = rt_se->back) + static inline struct rt_rq *group_rt_rq(struct sched_rt_entity *rt_se) { return rt_se->my_q; @@ -625,6 +628,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_back(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; @@ -1445,7 +1451,8 @@ static void dequeue_rt_stack(struct sched_rt_entity *rt_se, unsigned int flags) rt_nr_running = rt_rq_of_se(back)->rt_nr_running; - for (rt_se = back; rt_se; rt_se = rt_se->back) { + rt_se = back; + for_each_sched_rt_entity_back(rt_se) { if (on_rt_rq(rt_se)) __dequeue_rt_entity(rt_se, flags); }