From: "Yajun Deng" <yajun.deng@linux.dev>
To: "Peter Zijlstra" <peterz@infradead.org>
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()
Date: Thu, 27 Oct 2022 08:01:52 +0000 [thread overview]
Message-ID: <d57108689d0ab40cf6e51829bb938a2b@linux.dev> (raw)
In-Reply-To: <Y1o5i1Trk2aRZY4q@hirez.programming.kicks-ass.net>
October 27, 2022 3:55 PM, "Peter Zijlstra" <peterz@infradead.org> wrote:
> 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:
>>
Thanks for your guidance.
>> /* max.c */
>> #include <stdio.h>
>> #include <stdint.h>
>> #include <stdlib.h>
>>
>> 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
prev parent reply other threads:[~2022-10-27 8:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 1:53 [PATCH] sched/fair: Remove max_vruntime() and min_vruntime() Yajun Deng
2022-10-27 7:54 ` Peter Zijlstra
2022-10-27 7:55 ` Peter Zijlstra
2022-10-27 8:01 ` Yajun Deng [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d57108689d0ab40cf6e51829bb938a2b@linux.dev \
--to=yajun.deng@linux.dev \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox