lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 30 Aug 2009 02:06:57 -0400
From:	Ashwin Chaugule <ashwinc@...eaurora.org>
To:	Thomas Gleixner <tglx@...utronix.de>
CC:	linux-kernel@...r.kernel.org, mingo@...hat.com
Subject: Re: [RFC] [PATCH 1/1] hrtimers: Cache next hrtimer

Thomas Gleixner wrote:

> Hmm. I'd really like to know why that's behaving different. 
>
> Usually there are only timers in the CLOCK_MONOTONIC base during
> boot. CLOCK_REALTIME base should be empty most of the time. If my
> theory is correct then the number of reprogram events is correct as
> well because base[MONOTONIC]->first is always the one which armed the
> timer.
>
>
>   
Okay, I think I figured this out :)

I added some debug to find out how many timers are going to expire_next. 

hrtimer_reprogram()

   if (expires.tv64 == expires_next->tv64)

                if (timer != next_hrtimer)

                        timer->realtime++;  
(lazily reusing realtime here, coz we know its always zero otherwise ;) )

Now timer->realtime is very much non-zero :)

So, now base->first has already changed (leftmost node in the rb tree) and is 
pointing to this new timer node which is also going to expire_next, but hasn't
changed the value of expire_next (we just returned 0).

Therefore, in remove_hrtimer()

+	if (base->first == &timer->node) {
+		base->first = rb_next(&timer->node);
+		/* Reprogram the clock event device. if enabled */
+		if (reprogram && hrtimer_hres_active()) {
+			expires = ktime_sub(hrtimer_get_expires(timer),
+					    base->offset);


timer->node is going to point to the latest timer enqueued which is going 
to expire_next.

With your latest patch, we will force reprogram, but the next node to arm
the timer will be needless, because, its expiry is equal to expires_next.

So, by having a pointer like next_hrtimer, helps to represent all the timers
that are going to expire next, and thats why timer->cache_hits was always less
than timer->total_count.IOW, we avoided re-programming the device, if the 
next timer was going to expire at the same time as the one we just removed.

Thoughts ?

Cheers,

Ashwin

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ