From: Peter Zijlstra <peterz@infradead.org>
To: Yajun Deng <yajun.deng@linux.dev>
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 09:54:08 +0200 [thread overview]
Message-ID: <Y1o5ILxBd9erW5zR@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20221027015351.2511149-1-yajun.deng@linux.dev>
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 <stdio.h>
#include <stdint.h>
#include <stdlib.h>
typedef unsigned long long u64;
typedef unsigned long long s64;
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
next prev parent reply other threads:[~2022-10-27 7:54 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 [this message]
2022-10-27 7:55 ` Peter Zijlstra
2022-10-27 8:01 ` Yajun Deng
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=Y1o5ILxBd9erW5zR@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--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=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=yajun.deng@linux.dev \
/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