Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5584483rwl; Tue, 4 Apr 2023 00:07:26 -0700 (PDT) X-Google-Smtp-Source: AKy350aIWxGS3CvMg/REk/60+9BfV/l5s1C8taRFY0yyMrll/sz4fF0czx7RyK48X470jqBv9H9R X-Received: by 2002:a17:90b:4acc:b0:237:d2d8:3256 with SMTP id mh12-20020a17090b4acc00b00237d2d83256mr1827557pjb.20.1680592046482; Tue, 04 Apr 2023 00:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680592046; cv=none; d=google.com; s=arc-20160816; b=kDpVePLZCq6uqdg/aV7LYdtzGls4GHMH9+bmbvlFoaYszulmdPcSyNFhlSDLH6reoW +cdotUC7o0CjKDauWRYf0GDRPj6R2qwxRgySIB7RcjKnBXryMBz1BiSYhKkxUlJq/hVE lOhkRjghUwFemipxg5XYRp8Un5JTfKqY/A/Qd8Rl0epK496TXt1pcC6JJGyJs1eLSFU2 8+kH28CtzZ1QfLc0d/5R2EGk0V9C85Ne57wbx9/8dPj9KnllYTBX3OxxDoVyB9as/SH9 ba7nitfPVVFN3ehygOV5xjxuHAW7Q1tE7KXZv/giA3RGv6HIFsYa0Cm5pAFgv8/xPdwV Kubw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i22-20020a17090acf9600b00234ba530b89si14283001pju.146.2023.04.04.00.07.13; Tue, 04 Apr 2023 00:07:26 -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 S233642AbjDDHA0 (ORCPT + 99 others); Tue, 4 Apr 2023 03:00:26 -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 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 --- 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) -- 2.18.2