Re: [RFC][PATCH 1/3] time/tick: Pipe tick count down through cputime accounting
From: John Stultz
Date: Tue Jan 28 2025 - 23:11:16 EST
On Tue, Jan 28, 2025 at 6:44 AM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>
> On Mon, Jan 27 2025 at 22:32, John Stultz wrote:
> > In working up the dynHZ patch, I found that the skipping of
> > ticks would result in large latencies for itimers.
> >
> > As I dug into it, I realized there is still some logic that
> > assumes we don't miss ticks, resulting in late expiration of
> > cputime timers.
> >
> > So this patch pipes the actual number of ticks passed down
> > through cputime accounting.
>
> This word salad does not qualify as a proper technical changelog. See
> Documentation/
>
> > /*
> > * Must be called with interrupts disabled !
> > */
> > -static void tick_do_update_jiffies64(ktime_t now)
> > +static unsigned long tick_do_update_jiffies64(ktime_t now)
> > {
> > unsigned long ticks = 1;
> > ktime_t delta, nextp;
> > @@ -70,7 +70,7 @@ static void tick_do_update_jiffies64(ktime_t now)
> > */
> > if (IS_ENABLED(CONFIG_64BIT)) {
> > if (ktime_before(now, smp_load_acquire(&tick_next_period)))
> > - return;
> > + return 0;
>
> So if the CPU's tick handler does not update jiffies, then this returns
> zero ticks....
Oh, bah! You're right, of course.
I was thinking I could grab the tick delta that way, but blanked that
it wouldn't work anywhere but on the one tick_cpu.
I guess I was getting lucky with my tests running mainly on the tick_cpu.
I'll go back to the drawing board on this one. Thanks for pointing this out.
-john