Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp300951rwi; Thu, 27 Oct 2022 01:07:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FIyKfLTJU3DE6DCO5OjLKGIUKE11Jjwcnf4zKiF771i2WTreotw3Tr4CqYlIH2KUHH3y5 X-Received: by 2002:a17:907:270d:b0:7a5:f25d:9efe with SMTP id w13-20020a170907270d00b007a5f25d9efemr19705719ejk.640.1666858069461; Thu, 27 Oct 2022 01:07:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666858069; cv=none; d=google.com; s=arc-20160816; b=CoZV2mKYkvkRlODtBNC6wApz9x4VbEC6lTt7ZjTVSzsBt88C9DUHR0PiMVJu5gStp5 LnClM7ZiIGdvsxz1P7LAlaOhtTal55AOPaa7qjFaYMfu/QiD3bbzDjTT2UFEmxEGbM7I 39me0Kqkh7LLt+Aqju6LoA3cK2++tBbL2aRxycIw/zYHaT5ESUmmBa0UhENoLR4QYPPQ aS06i/VJ2/TzeB+LeY1ayYfDbndHCGaRUAQu9jSgIlc3H9OJ597+330vz8sBMnhb7ogw jx+AMK0I+Fbj6efnt999mb/LBOKksMMrf4OM3S9Z50tSRjCQy9LgBn38nmqmoHpye+6H /b+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5zl7dX9EpgclanizFHawlSrlLA7C4BACktFiPWCWkC8=; b=0Wnxz5M6qWEU7ZE8f4JOo7FygTRGMrXLZQfUSvG504PhGSzgT18J5ffQMRy5d+IUBs IzZHVFtkg4RMLzMteSDN2A2EXp2JJcKI3/+Y0/LOPb4xyzub5EWpqC6hKxNJ2GPchwTN Hh1V+I0CL5NT+L62Qwiz5v2a2UaYiA7yr/plWv8lgm4gHGslVfbyKx688OSmwBVoX2eb aycsB1a61g1ZvVPWSl1aMdAmpIJnU6Wro2QI1+dvOQIKH9MZyQmsOr6uvp2Q+is59p13 GOWLPpD9bP4FF7jhjAMeFKPqWrRtB3hl6+3d0y4mEo5WnonxVJ3uNgECn7WavSJQTxny O2kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=nNGgWCX7; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ft29-20020a170907801d00b0078ddde15fdcsi609208ejc.279.2022.10.27.01.07.23; Thu, 27 Oct 2022 01:07:49 -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=@infradead.org header.s=desiato.20200630 header.b=nNGgWCX7; 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 S234509AbiJ0H40 (ORCPT + 99 others); Thu, 27 Oct 2022 03:56:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234147AbiJ0H4X (ORCPT ); Thu, 27 Oct 2022 03:56:23 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11C8C9E0D7 for ; Thu, 27 Oct 2022 00:56:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=5zl7dX9EpgclanizFHawlSrlLA7C4BACktFiPWCWkC8=; b=nNGgWCX7M5YzzPx3DVqPxLB9mU 1SjuwIUu9yfPOXdnRw+UXWI6ixnnrH9Sbx9kyBsgOryzdr/R7NIZiKQro9Bj5trZLGpayUNaP4tuJ F2Fn5JH2br9ur5uK+C5cgtFgKrXU4mxMKTfcF06Kabo3I6IE2MCF/y+YanrJh7I6zwoINlPvDB6hR L471+706a+9QITtPGdt7zPiP6OfjHfBf66r6jgoSwqgu9JexsNa9y3YuMWP9mIqtpp8MFqswovchD MaiEx9C9Eb5W5MGGuuU07yIvPHc6mD0cnFOdmziYqxDL5uZx/GVCj4662SmwraTmKt4Fl9O4QsqSe CWBuLegw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1onxk5-006nz0-3O; Thu, 27 Oct 2022 07:55:59 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 1242830029C; Thu, 27 Oct 2022 09:55:56 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id F0D152012B90F; Thu, 27 Oct 2022 09:55:55 +0200 (CEST) Date: Thu, 27 Oct 2022 09:55:55 +0200 From: Peter Zijlstra To: Yajun Deng 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 Subject: Re: [PATCH] sched/fair: Remove max_vruntime() and min_vruntime() Message-ID: References: <20221027015351.2511149-1-yajun.deng@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 On Thu, Oct 27, 2022 at 09:54:09AM +0200, Peter Zijlstra wrote: > On Thu, Oct 27, 2022 at 09:53:51AM +0800, Yajun Deng wrote: > > There is no need to write max_vruntime() and min_vruntime() functions, > > we can use max_t() and min_t() instead. > > Here; I did your homework for you: > > /* max.c */ > #include > #include > #include > > typedef unsigned long long u64; > typedef unsigned long long s64; This should obviously be just 'long long', but the result doesn't change. /me goes goes get more wake-up juice. > > static u64 max_vruntime(u64 max_vruntime, u64 vruntime) > { > s64 delta = (s64)(vruntime - max_vruntime); > if (delta > 0) > max_vruntime = vruntime; > return max_vruntime; > } > > static u64 max(u64 a, u64 b) > { > return a > b ? a : b; > } > > int main(int argc, char **argv) > { > u64 a, b; > > if (argc < 3) > return 0; > > a = strtoll(argv[1], NULL, 10); > b = strtoll(argv[2], NULL, 10); > printf(" max(%lu, %lu) = %lu\n", a, b, max(a,b)); > printf("max_vruntime(%lu, %lu) = %lu\n", a, b, max_vruntime(a,b)); > > return 0; > } > > $ ./max -1 0 > max(18446744073709551615, 0) = 18446744073709551615 > max_vruntime(18446744073709551615, 0) = 0