Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1355507rwl; Wed, 5 Apr 2023 16:07:36 -0700 (PDT) X-Google-Smtp-Source: AKy350Y2penRooV9Rglg4IQaPV3KFnPCLr7cNoBjhIwhhogRV3ixkndV2j44bKJQBwc7eY3lrORF X-Received: by 2002:a17:903:11cf:b0:1a3:c8c2:c322 with SMTP id q15-20020a17090311cf00b001a3c8c2c322mr9527622plh.29.1680736056567; Wed, 05 Apr 2023 16:07:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680736056; cv=none; d=google.com; s=arc-20160816; b=wHHKuLqmjPBbgjPzT5vzRCl3o3pmnZkC1xxI7GlHNKuBg50kqd3bKtcZ3NZocc/INe MMrO7QmehBLiSrrWr3aKBo+EJhvhfiGyrkZemfAsGHDpnRKg0aQVt70pC/Kv1zLl2Wsk DKPD3VNALf8KvMkPf8+AiIJjKAPXHmgJ3YiODNVH9hb6ueeE6Zx+raIl5XBubSH9k7Gn L6NPgckygNkm/aChFpQwv0Fakd1hLBXK8eCNRI/9Dh50Yi9HQsFqlJT5rDMrxVDYg6o/ H3BPeqLVC6zIwhZfwWQYJABnEVkVmgzHMaobaFO9igV8ZT9tzdftXDpv0cnQcBtM9iB1 5dNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=rEo6jN4HOQ1exluKJ/qpFmiL7TSE9GJcFWqU81sdmGc=; b=ys8q+yffLOxeSsCEtWUxxc6NAsQ0keRP4Ne006Nlw67XBWQcWZQOhboV/uhI2puVBq VZc8rkIBaVr3byaqonlW02Qxrb0mSpcXtkbQwsY+I6HigvMv6oHb8Su7j/17aNVAbx+Q C8rb2LUtRku7nHx5psYQfZzUDnkLr4orLyLVLr7hGwMjP+MW5QJH56Au/H0tQTLjNvfA teq6G1tEuZNBKjU29n2NJt+BudymhRHwtGt9Ba023/pQKHHNlLjW9Q0GXn/YPpX0bJEK uSSsaYbSRS8+gawKKB5QBH1+9M/i6PbloxFCDOndf+eYi8ufEz7eW99873z/P3JRfqjL ZVzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UQrTagLx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e10-20020a65478a000000b005023e0f160dsi13341574pgs.489.2023.04.05.16.07.18; Wed, 05 Apr 2023 16:07:36 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=UQrTagLx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232656AbjDEXEp (ORCPT + 99 others); Wed, 5 Apr 2023 19:04:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232869AbjDEXEn (ORCPT ); Wed, 5 Apr 2023 19:04:43 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEC037A9F for ; Wed, 5 Apr 2023 16:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680735879; x=1712271879; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=DUFoSzec5fZiiQaU9RW0QF5RKVNJleEQFUuWZQ4zhgI=; b=UQrTagLxQWM3HQSrCQQX42owEXt0Laz4ydI07xcGzbEd3P4xrB7qfUoB A0/h0dLpyxJn87j0VVVeBrmXipL+arMdQk+jytfKqmAzgzs+qYziewIo5 IjcSkJcUjxqa9vaeaACmpPNmjXoUyrXe9pXn96CGm6D0aS04otBE3s1Sf BJHBVc8TM/oQ+HdxQqZ7m8cYhenKc6Cl1LQ5gQC5falKLKHulqLNiuI1z IZz+Er3xx0n2s84IZJDjP48yq/nSXvKHK/SAECn0x5vdDqPQWffAgpx86 nXedqIkuE+cvZe9o3wJrsy6H3On7XX0CXFhy4AkDNhkz+vFFntiYRx0vp A==; X-IronPort-AV: E=McAfee;i="6600,9927,10671"; a="345179016" X-IronPort-AV: E=Sophos;i="5.98,322,1673942400"; d="scan'208";a="345179016" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2023 16:04:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10671"; a="664225729" X-IronPort-AV: E=Sophos;i="5.98,322,1673942400"; d="scan'208";a="664225729" Received: from skansra-mobl.amr.corp.intel.com (HELO [10.209.62.228]) ([10.209.62.228]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2023 16:04:38 -0700 Message-ID: <5b8bbe752ce03cc690441cf4b6f6fe0f608a1e54.camel@linux.intel.com> Subject: Re: [PATCH] sched: rt: Optimization function 'pick_next_rt_entity' From: Tim Chen To: Li zeming , 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 Date: Wed, 05 Apr 2023 16:04:38 -0700 In-Reply-To: <20230405232900.4019-1-zeming@nfschina.com> References: <20230405232900.4019-1-zeming@nfschina.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 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 On Thu, 2023-04-06 at 07:29 +0800, Li zeming wrote: > 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. Suggest changing the subject from "Optimization function 'pick_next_rt_enti= ty' to "Simplify pick_next_rt_entity()" Suggest simplifying the comment: Remove useless intermediate variable "next" and its initialization. Direct= ly return the next RT scheduling entity obtained from list_entry(). Otherwise the patch itself looks fine. Reviewed-by: Tim Chen >=20 > Signed-off-by: Li zeming > --- > kernel/sched/rt.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) >=20 > 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 =3D &rt_rq->active; > - struct sched_rt_entity *next =3D NULL; > struct list_head *queue; > int idx; > =20 > @@ -1779,9 +1778,8 @@ static struct sched_rt_entity *pick_next_rt_entity(= struct rt_rq *rt_rq) > queue =3D array->queue + idx; > if (SCHED_WARN_ON(list_empty(queue))) > return NULL; > - next =3D list_entry(queue->next, struct sched_rt_entity, run_list); > =20 > - return next; > + return list_entry(queue->next, struct sched_rt_entity, run_list); > } > =20 > static struct task_struct *_pick_next_task_rt(struct rq *rq)