From patchwork Fri Apr 7 18:09:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li zeming X-Patchwork-Id: 80018 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp710193vqo; Wed, 5 Apr 2023 18:53:46 -0700 (PDT) X-Google-Smtp-Source: AKy350Y2Kng5NyqKEIL7aEgJHEIwttuAUtXPknSUHAqKigW6PSH/DcJd/mU6OMJxlzNHhrSZ5kkL X-Received: by 2002:a17:906:9bca:b0:947:f937:d58c with SMTP id de10-20020a1709069bca00b00947f937d58cmr4446039ejc.73.1680746026196; Wed, 05 Apr 2023 18:53:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680746026; cv=none; d=google.com; s=arc-20160816; b=K525fWm3yi5IaSBcRSwDwtSaH647QyKq/NztkuEirWRa4Zci0LdgXKUH/7b2hAjtaE s+IjNOXgC9tqCHzatV5E0dfbK0XV8//cysri4Tj0Bif3dbkPl/OkK2nDiRHI3dxOzzxa 14q9VotlREBFaFCLa2tjoJ0fcKr3ZgwhDt3rrh9oxP3OI0y+JV/B76Mq36roKh5LqDPx VqWSX9pp+OAnHV9VSNtJkZGnXOa9KT5wnvAvqWTImCUJ5HUZHpKSITTGv3g6Z7XkcRpV s67QX6sB8ky5ljW1sMN5DwvlYRQijrmEY+vqbn6LAkhcfvY0/JoXA6pAFsObi6Zm7QvV Lpfg== 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=u/2I10kJiW4PUO5z+A3YZlSKqnnseW/4bRkdOTObfX4=; b=MtIBdWAE2niOGXqmFfzu6oYKHldaVOOTOzzKWex/g7teUfkCsSUBTt94kmFZlLNWGE pPrm57LJtMrMqR/aqUpQUgFweMFYYQTeKeUMhG+nmEP5F7ys9CSeXnTpfUkrJ2WaxqZP ra92Tzqi1ziUfssHCZ3smJaDmpNirD0/r0pHMJvzK/sMUJvYX8mZiaXm+xUjyOe31Wl+ arudi3lFr6/JoCALIm/A/nHx9C40WOBJKx/WDvLFElXraJWQ32kbo5kTeS2Ax5dNaj8v qUW/81VNEFW5auFpW4Us80gfsz0a1tSxWSsEBXvjcf7sJNuEnEUxOIHp5OvgCB5fzxDs r+wQ== 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 ec19-20020a170906b6d300b00925a9b6ed47si174809ejb.755.2023.04.05.18.53.22; Wed, 05 Apr 2023 18:53:46 -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 S234629AbjDFBio (ORCPT + 99 others); Wed, 5 Apr 2023 21:38:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234609AbjDFBil (ORCPT ); Wed, 5 Apr 2023 21:38:41 -0400 Received: from mail.nfschina.com (unknown [42.101.60.222]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3383D6A45 for ; Wed, 5 Apr 2023 18:38:38 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id 16A321A00B04; Thu, 6 Apr 2023 09:38:51 +0800 (CST) X-Virus-Scanned: amavisd-new at nfschina.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (localhost.localdomain [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eVFBE7vZW73S; Thu, 6 Apr 2023 09:38:50 +0800 (CST) Received: from localhost.localdomain (unknown [219.141.250.2]) (Authenticated sender: zeming@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id 083B31A00B02; Thu, 6 Apr 2023 09:38:50 +0800 (CST) 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 v2] sched: rt: Simplify pick_next_rt_entity() Date: Sat, 8 Apr 2023 02:09:52 +0800 Message-Id: <20230407180952.2757-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?1762389944981804893?= X-GMAIL-MSGID: =?utf-8?q?1762389944981804893?= Remove useless intermediate variable "next" and its initialization. Directly return the next RT scheduling entity obtained from list_entry(). Signed-off-by: Li zeming Reviewed-by: Tim Chen --- v2: Simplify title and descriptive information. 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)