Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7063980rdb; Wed, 3 Jan 2024 03:30:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFggOuK/mWNAJF0Z6vuzNdH6J2iehFXtZEgYiVF9emRYADrh7DreXyL9lG4ucVxguoB5Pye X-Received: by 2002:a05:6a21:a581:b0:198:85d7:e53b with SMTP id gd1-20020a056a21a58100b0019885d7e53bmr143311pzc.114.1704281433781; Wed, 03 Jan 2024 03:30:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704281433; cv=none; d=google.com; s=arc-20160816; b=vbNpSYdm6rK19LZsZMipYBLOTDaTlkuQIxIyvWuIWCIKk1foLQWlhy4wZDxSAdNF3l Ved+YQEiTY+wYv/pV+VYO4qyZboMOHPzfNd8VK51tFIDZGQhVY2zqagmIdV/57CUVQYk wQrlT0VOAeBjWZva+xwmG/+Veau8dPk6dewT7jiFhL6Bt2f5yw50GWGIzi+3uBF2pVKm 4tEJUDffdWvDIYd00/Euqdzs3wi4MI/vHpnckZHSxOSirfFgeD6jYRbUTgyiWjoPFl3k ikaUbUNOWNR1hxc5zvOyZFs6M2+3/GVUT6/vamSarKzJbsXARVq7TUDj/uO5ZTrj8tS8 BDvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=Ko5XdqJYFBFQqq2Q/ZWUmpuhBslz60gTyv1hKvfLXz4=; fh=y/SqVecVykCntnS5bAVol1QQXtrG/2J/EieX3/zu8Qw=; b=EvhgpHZqzHgyOYb4FhydlqDupxh5jtVEAHUtcAKrzEh3StLtWKurPin/nOqgRtGdoF gmlbDVyM0h7yXUh5/MiAvtTwCRIhWrQC4QGDmSOK26kEBOhjFG+HZ6VbvnnQbrVubE+Y ak/C19dWR2UFRIag2XGKIvE/x0PzJCsjUBHIrHj47gxoNtHdt29wOKMT780EPDljzNz/ Mrfr/eVkG2EPFAhLWd45zt8zMdulrjoZHR/trX7L+fH44mW1RHeYhTpNy1g+/zOXtumv YAx2WnaZuiSkjeUPKnxXKCNmIYtEQC5Oco7rzTlaAt136834/vLIFCijH3bgdTPiwKGe twoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-15449-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15449-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id ha22-20020a17090af3d600b0028c30cbc28csi1077973pjb.110.2024.01.03.03.30.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 03:30:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15449-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-15449-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15449-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 14630B23474 for ; Wed, 3 Jan 2024 11:29:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 938D618E3A; Wed, 3 Jan 2024 11:29:46 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C53FA18EA1 for ; Wed, 3 Jan 2024 11:29:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R901e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=liusong@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0Vzu1kGO_1704281354; Received: from localhost(mailfrom:liusong@linux.alibaba.com fp:SMTPD_---0Vzu1kGO_1704281354) by smtp.aliyun-inc.com; Wed, 03 Jan 2024 19:29:40 +0800 From: Liu Song 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, liusong@linux.alibaba.com Subject: [PATCH] sched/eevdf: remove the unused function max_vruntime and simplify the implementation of min_vruntime Date: Wed, 3 Jan 2024 19:29:14 +0800 Message-Id: <20240103112914.77856-1-liusong@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The function max_vruntime is defined but not used, and under EEVDF, there's no need to focus on max vruntime, so it's highly unlikely that the function will be used in the future. Even if it were to be used, max_vruntime simply returns the larger value of two vruntimes, and such a naming convention could easily cause confusion, leading one to mistakenly believe that alongside the meaningful concept of min_vruntime in EEVDF, there might also be a concept of max_vruntime. Therefore, the function should be removed. Furthermore, since vruntime is monotonically increasing, the implementation of the function min_vruntime has been simplified. Signed-off-by: Liu Song --- kernel/sched/fair.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 533547e3c90a..0370e5d0be78 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -530,19 +530,9 @@ void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec); * Scheduling class tree data structure manipulation methods: */ -static inline u64 max_vruntime(u64 max_vruntime, u64 vruntime) -{ - s64 delta = (s64)(vruntime - max_vruntime); - if (delta > 0) - max_vruntime = vruntime; - - return max_vruntime; -} - static inline u64 min_vruntime(u64 min_vruntime, u64 vruntime) { - s64 delta = (s64)(vruntime - min_vruntime); - if (delta < 0) + if (vruntime < min_vruntime) min_vruntime = vruntime; return min_vruntime; @@ -748,10 +738,8 @@ int entity_eligible(struct cfs_rq *cfs_rq, struct sched_entity *se) static u64 __update_min_vruntime(struct cfs_rq *cfs_rq, u64 vruntime) { u64 min_vruntime = cfs_rq->min_vruntime; - /* - * open coded max_vruntime() to allow updating avg_vruntime - */ s64 delta = (s64)(vruntime - min_vruntime); + if (delta > 0) { avg_vruntime_update(cfs_rq, delta); min_vruntime = vruntime; -- 2.19.1.6.gb485710b