mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Yu Zhe <yuzhe@nfschina.com>
Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	liqiong@nfschina.com
Subject: Re: [PATCH] x86/aperfmperf: use time_is_before_jiffies(a + b) to replace "jiffies - a > b"
Date: Thu, 28 Jul 2022 12:30:04 +0200	[thread overview]
Message-ID: <YuJlLK4x9aUuqHQZ@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <ecd4dcc3-321c-e228-96a3-bac08c56794a@nfschina.com>

On Thu, Jul 28, 2022 at 10:55:51AM +0800, Yu Zhe wrote:
> 在 2022年07月28日 00:00, Peter Zijlstra 写道:
> 
> > On Wed, Jul 27, 2022 at 11:14:05AM +0800, Yu Zhe wrote:
> > > time_is_before_jiffies deals with timer wrapping correctly.
> > Please explain how the current code does not.
> 
> 1. If the timer wrap changes in the future you won't have to alter your code.
> 
> 2. unsigned long ut;
> 
>    ut = ULONG_MAX + 4;
> 
>    printf("time_after(ut, ULONG_MAX), ut:%d, %d --> %d\n", ut,
>              time_after(ut, ULONG_MAX), (ULONG_MAX - ut) < 0);
> 
> 
>    In this case, time_after returns true, it's correct.

Now try the same with the existing code...

      reply	other threads:[~2022-07-28 10:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-27  3:14 Yu Zhe
2022-07-27 16:00 ` Peter Zijlstra
2022-07-28  2:55   ` Yu Zhe
2022-07-28 10:30     ` Peter Zijlstra [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=YuJlLK4x9aUuqHQZ@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liqiong@nfschina.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yuzhe@nfschina.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

all inboxes | Powered by JetHome®