Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp315876rwi; Thu, 27 Oct 2022 01:23:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6UIVd1ZAX/JlFZZhw7RPxKHpwK7RhQmdxmV/kpy9Zijbx5Jzrg96FcaW8/Yx3XAP5PUwKA X-Received: by 2002:a05:6402:b2f:b0:461:701e:877a with SMTP id bo15-20020a0564020b2f00b00461701e877amr25096739edb.82.1666859018459; Thu, 27 Oct 2022 01:23:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666859018; cv=none; d=google.com; s=arc-20160816; b=AlqEGU2oxfAaqE+hYEhlJcnIGIZysxjXz7r5l5WCH9uHTGIxq3ARg7TtUawDtUrzBg 0PwE7CjrRcLgT6Z8sN4I78Y0togSQUPHqNuONgGoqOpQPaTL/9YCFSas298XXt+en9Wu ftM3JcNWTIxB8fUhHwAH5WUhWH/8j21uAlyp92m7XDKAWkyw+MZzLd+ZFjiJNC2Xv7xj gOqMSSWjeNiDoBtmrJ2dYUo8chtVjwLsl33F3xN12Qg9IRkO9feXXhdpX4QAGRqozvLc 4CQ9BiDxgspcpwiEOP9RmWtk4vsteK7tFnQvLf4QJsxMso+fB7BizJGmnTEwXHlENp6G +lDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:cc:to:subject:message-id :from:content-transfer-encoding:date:dkim-signature:mime-version; bh=vVjJzq3U20aYMF/dJkFMJFu3ZKsg/eho1ketNisEpgI=; b=rExNRlLn71fJ0en6nj0ivWlv5jK/poe1tGh3FZTLND/SeHqodJJBXTd9ASmzrUB1ql GVqbXIF0gCoclkoDEGEtq9M43ZWzctmUHhMg42CUdAcLU1L0yIoM9526y5PzOW8unz0G rOq+iiiuK4Nen8lVJ1QMzkBxP1hqNs93RmZlYa++2AbAm6fOmfjSRLm1IqQlTgYEklrp NT/rPFUR2YkB0oaPrk0JP+JasVtucJ7SN/APbXZVERJA4h1vG+Ggx4jwdxVeA8pH80DO UUI119LpYgdYChIqKILz8K+3hgUM1LpBsZBiSqnV61m+RZd4UuVY4E4k3TNR7rjdF8lO M+qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="NubST/zb"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g5-20020a1709065d0500b007acf3aed493si903080ejt.910.2022.10.27.01.23.13; Thu, 27 Oct 2022 01:23:38 -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="NubST/zb"; 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 S234745AbiJ0ICU (ORCPT + 99 others); Thu, 27 Oct 2022 04:02:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234720AbiJ0IB6 (ORCPT ); Thu, 27 Oct 2022 04:01:58 -0400 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44A2C27911 for ; Thu, 27 Oct 2022 01:01:55 -0700 (PDT) MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1666857713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vVjJzq3U20aYMF/dJkFMJFu3ZKsg/eho1ketNisEpgI=; b=NubST/zblFSFf3RDRcfxowq05OdFMo1aMiZVzokilLMCp97dwkDbtC+L01d0fJoRfrfEbh ehsLLqZXLerM/wmoZdk7ZGzMzBAlkpK2dEsaEcOll3E2tQAr8+N7shzqrWU9zexBgzbX6L Y5WYI/vJN7t0hAJ557vRJgzwXfCkwu0= Date: Thu, 27 Oct 2022 08:01:52 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Yajun Deng" Message-ID: Subject: Re: [PATCH] sched/fair: Remove max_vruntime() and min_vruntime() To: "Peter Zijlstra" Cc: mingo@redhat.com, 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, linux-kernel@vger.kernel.org In-Reply-To: References: <20221027015351.2511149-1-yajun.deng@linux.dev> 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 October 27, 2022 3:55 PM, "Peter Zijlstra" wrote:= =0A=0A> On Thu, Oct 27, 2022 at 09:54:09AM +0200, Peter Zijlstra wrote:= =0A> =0A>> On Thu, Oct 27, 2022 at 09:53:51AM +0800, Yajun Deng wrote:=0A= >> There is no need to write max_vruntime() and min_vruntime() functions,= =0A>> we can use max_t() and min_t() instead.=0A>> =0A>> Here; I did your= homework for you:=0A>> =0A=0AThanks for your guidance.=0A=0A>> /* max.c = */=0A>> #include =0A>> #include =0A>> #include =0A>> =0A>> typedef unsigned long long u64;=0A>> typedef unsigned long= long s64;=0A> =0A> This should obviously be just 'long long', but the re= sult doesn't=0A> change.=0A> =0A> /me goes goes get more wake-up juice.= =0A> =0A>> static u64 max_vruntime(u64 max_vruntime, u64 vruntime)=0A>> {= =0A>> s64 delta =3D (s64)(vruntime - max_vruntime);=0A>> if (delta > 0)= =0A>> max_vruntime =3D vruntime;=0A>> return max_vruntime;=0A>> }=0A>> = =0A>> static u64 max(u64 a, u64 b)=0A>> {=0A>> return a > b ? a : b;=0A>>= }=0A>> =0A>> int main(int argc, char **argv)=0A>> {=0A>> u64 a, b;=0A>> = =0A>> if (argc < 3)=0A>> return 0;=0A>> =0A>> a =3D strtoll(argv[1], NULL= , 10);=0A>> b =3D strtoll(argv[2], NULL, 10);=0A>> printf(" max(%lu, %lu)= =3D %lu\n", a, b, max(a,b));=0A>> printf("max_vruntime(%lu, %lu) =3D %lu= \n", a, b, max_vruntime(a,b));=0A>> =0A>> return 0;=0A>> }=0A>> =0A>> $ .= /max -1 0=0A>> max(18446744073709551615, 0) =3D 18446744073709551615=0A>>= max_vruntime(18446744073709551615, 0) =3D=200