From patchwork Wed Apr 5 23:29:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li zeming X-Patchwork-Id: 78876 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2826758vqo; Tue, 4 Apr 2023 00:07:00 -0700 (PDT) X-Google-Smtp-Source: AKy350bYCMU6O05aLp5h4aW+BPFF5FL3ZTlQKHGEBfiT7DiR8hZz2ZlCGZ8uNA2eR4E7eBLFiktt X-Received: by 2002:a17:902:f54d:b0:19f:27fe:95c3 with SMTP id h13-20020a170902f54d00b0019f27fe95c3mr2151220plf.41.1680592020576; Tue, 04 Apr 2023 00:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680592020; cv=none; d=google.com; s=arc-20160816; b=NqUfPj1OvbH7xX+UIHEF4IxpqJlFpsSidZ0lFvPbrcJ4XPhdxqUPdeGSBP4MKXikLk o7APSuUOZxwPqhfAqcH+tshfl7kXYxi4vjsj60fJE5UouBxgnXV97qs0npminjZAYMAT 5ASss/Kt+UEoPh3/MODMKZtTsGfdzg4JxxBpoVcxEdOWtDuLMR7Z4tL+O5Pqljf14u4n NU324bloxnIEw6D0jgihmWN2a4s4dkzY54qdZZxvRw/3W4Hv4CARRvlE08UBNVdQYZme h8aqoibKQyJHCFvdbx6PW3mjvXGxovwS/Fq2J5DXAPv8EZ34npMxN5Fcp920Zq02VPLd rAxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=AWbfxT6OIUu9XiVGL4YVBGzR8GWvdc5pHw3pcOXG9DM=; b=SdNH8a12Pk/I282v4IKs6bi+Dtsb6HYWjXa3P+RcVsP4La3UFkitz+SMbUAWA6odJ4 Zd8hxONCJz9vMITJNKZ2tW/z19G64LF+WjCZ16mHHbxSTQiENGsRFmkcoEAzKFaEROSR PH/H1tzU3d9vJnV/glejC5CudeLs/SKgfHlXOJkDiAi5MHFu+w+lgAZzYMXJEkcvP8oF z437+6ODyT4VMF4OOKNm6Efv5TQsx2ZzHdmzjreevlLYRn4VPHGDWDGFGllGlaKCvLGf /RO2ahZGCxpyiwBSpG/oOtE9bHMyCfwH/0jCPCHj5RlNddI++5SKdgI+VnORgD8HvAz5 wc9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e18-20020a656892000000b0050309caf60esi9678241pgt.750.2023.04.04.00.06.47; Tue, 04 Apr 2023 00:07:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229629AbjDDHA1 (ORCPT + 99 others); Tue, 4 Apr 2023 03:00:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233735AbjDDHAX (ORCPT ); Tue, 4 Apr 2023 03:00:23 -0400 X-Greylist: delayed 123 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 04 Apr 2023 00:00:21 PDT Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 06FC210CF for ; Tue, 4 Apr 2023 00:00:20 -0700 (PDT) Received: from localhost.localdomain (unknown [40.50.201.1]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id 3602D18008E786; Tue, 4 Apr 2023 14:57:42 +0800 (CST) X-MD-Sfrom: zeming@nfschina.com X-MD-SrcIP: 40.50.201.1 From: Li zeming 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, Li zeming Subject: [PATCH] sched: rt: Optimization function 'pick_next_rt_entity' Date: Thu, 6 Apr 2023 07:29:00 +0800 Message-Id: <20230405232900.4019-1-zeming@nfschina.com> X-Mailer: git-send-email 2.18.2 X-Spam-Status: No, score=2.5 required=5.0 tests=DATE_IN_FUTURE_24_48,RDNS_NONE, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762228458754776016?= X-GMAIL-MSGID: =?utf-8?q?1762228458754776016?= The moral of this function is to obtain the next RT scheduling entity object,while 'list_entry' Implementation function of 'container_of' returns the next RT scheduling entity object (no new code should be added afterwards), directly returning 'list_entry' The execution result is sufficient. Signed-off-by: Li zeming Reviewed-by: Tim Chen --- kernel/sched/rt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 0a11f44adee5..e9b1c08c20a7 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1769,7 +1769,6 @@ static inline void set_next_task_rt(struct rq *rq, struct task_struct *p, bool f static struct sched_rt_entity *pick_next_rt_entity(struct rt_rq *rt_rq) { struct rt_prio_array *array = &rt_rq->active; - struct sched_rt_entity *next = NULL; struct list_head *queue; int idx; @@ -1779,9 +1778,8 @@ static struct sched_rt_entity *pick_next_rt_entity(struct rt_rq *rt_rq) queue = array->queue + idx; if (SCHED_WARN_ON(list_empty(queue))) return NULL; - next = list_entry(queue->next, struct sched_rt_entity, run_list); - return next; + return list_entry(queue->next, struct sched_rt_entity, run_list); } static struct task_struct *_pick_next_task_rt(struct rq *rq)