From patchwork Thu Oct 27 01:53:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yajun Deng X-Patchwork-Id: 11516 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp586584wru; Wed, 26 Oct 2022 18:55:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7nIZjNW1n9Y6UAcric9G0NgDavZldNprTLhdwtbFLl07nABPD7JtIoLScLJhxIbaqkWwTt X-Received: by 2002:a63:90c9:0:b0:46e:dd5a:d921 with SMTP id a192-20020a6390c9000000b0046edd5ad921mr21287999pge.282.1666835702178; Wed, 26 Oct 2022 18:55:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666835702; cv=none; d=google.com; s=arc-20160816; b=xf98HBCdEwGH+bxcihb7gqGUgGd3hJDXOcW6nXCz3Dh/041oTAc3SVPK7/JKDOEOx2 BGvrCMQdP+l4odcKKbOnktOf3Zq69qv04L748s8p3iwCYAyrDw0D1lKJNbXSyhKK91mq Nus4QUrye8n7tRTERbdmVkuEw9BJCfCGHmWsv3HHefRmVdBEuTuEI690lQfTuBA4Royo /uTv8Gv1do5RwrA+vmOeqG2z4vRYYgEvdS6s7r+4kD3zH5pcYK4VjSDP3FEKuWdoyMGO AAn+YBlkbWA9TpUtN2UIudY6dVeDlbOnJV29PjmzCy7TeUALEC5GodTDLUa9p92It2cm BCrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kNJqfms1eRu/a/XyA/vXGP2HAHD0ZQEDTi1N1gMZ+lY=; b=X1el+oJVkEiPAHo1vwnUwcEQ2ZgBnGaezbc7U0dgneQgqclp6sXCdXmNBksKGSsVPm e5fJiKLUWUT1snEGiff3b0Bi4g78W8ioyKIdZrleXbjU4MYelVvaL7GR7mVAlUeSw6iv ShAem9WFU/loVTxR+m2o1xZryamKMjDBguulpVTKv2anZdaayqzTv+JGxn4m34vw+a8J Tfv7TcdLfEIS9tKt4RZddz9RFj6W8NiySey0JCRPltvxnKlfd7GRqhcpY6qy0tzy0FIX MT6oXbGlhpU4r1Ac6m8SYdOu44eYMCX1pICtykaOagU3h8xyseGr4eGrdVDHQt3WPUWb +9sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=JBa0f4qP; 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=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v9-20020a655689000000b00460a6ee5b53si7987050pgs.37.2022.10.26.18.54.41; Wed, 26 Oct 2022 18:55:02 -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=@linux.dev header.s=key1 header.b=JBa0f4qP; 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=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232946AbiJ0Byi (ORCPT + 99 others); Wed, 26 Oct 2022 21:54:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232679AbiJ0Byd (ORCPT ); Wed, 26 Oct 2022 21:54:33 -0400 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 772C3101F2 for ; Wed, 26 Oct 2022 18:54:30 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1666835668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=kNJqfms1eRu/a/XyA/vXGP2HAHD0ZQEDTi1N1gMZ+lY=; b=JBa0f4qPXeWSmChcJLY9mHnM2Wo6w07mz/Sw5YY1N5I3/op908s3fnUwk4ATIEGg4sS4pV zjYUqWUFdLCkGWl00CmzGUub8B9S8sUHtePdl/ab46qxD4K54vhldMycHXSTEWE70jLLE3 z3D8WzPgnZvYFKHTlGeUXS7/mXy3xc0= From: Yajun Deng 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, Yajun Deng Subject: [PATCH] sched/fair: Remove max_vruntime() and min_vruntime() Date: Thu, 27 Oct 2022 09:53:51 +0800 Message-Id: <20221027015351.2511149-1-yajun.deng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747803913173039908?= X-GMAIL-MSGID: =?utf-8?q?1747803913173039908?= There is no need to write max_vruntime() and min_vruntime() functions, we can use max_t() and min_t() instead. Signed-off-by: Yajun Deng --- kernel/sched/fair.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e4a0b8bd941c..bba8e0c43d59 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -562,24 +562,6 @@ 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) - min_vruntime = vruntime; - - return min_vruntime; -} - static inline bool entity_before(struct sched_entity *a, struct sched_entity *b) { @@ -609,12 +591,12 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq) if (!curr) vruntime = se->vruntime; else - vruntime = min_vruntime(vruntime, se->vruntime); + vruntime = min_t(u64, vruntime, se->vruntime); } /* ensure we never gain time by being placed backwards. */ u64_u32_store(cfs_rq->min_vruntime, - max_vruntime(cfs_rq->min_vruntime, vruntime)); + max_t(u64, cfs_rq->min_vruntime, vruntime)); } static inline bool __entity_less(struct rb_node *a, const struct rb_node *b) @@ -4543,7 +4525,7 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial) } /* ensure we never gain time by being placed backwards. */ - se->vruntime = max_vruntime(se->vruntime, vruntime); + se->vruntime = max_t(u64, se->vruntime, vruntime); } static void check_enqueue_throttle(struct cfs_rq *cfs_rq);