Re: [PATCH/RFC] msleep() with hrtimers

From: Jonathan Corbet
Date: Mon Jul 16 2007 - 10:42:42 EST


Hey, Roman,

> One possible problem here is that setting up that timer can be
> considerably more expensive, for a relative timer you have to read the
> current time, which can be quite expensive (e.g. your machine now uses the
> PIT timer, because TSC was deemed unstable).

That's a possibility, I admit I haven't benchmarked it. I will say that
I don't think it will be enough to matter - msleep() is not a hot-path
sort of function. Once the system is up and running it almost never
gets called at all - at least, on my setup.

> One question here would be, is it really a problem to sleep a little more?

"A little more" is a bit different than "twenty times as long as you
asked for." That "little bit more" added up to a few seconds when
programming a device which needs a brief delay after tweaking each of
almost 200 registers.

> BTW there is another thing to consider. If you already run with hrtimer/
> dyntick, there is not much reason to keep HZ at 100, so you could just
> increase HZ to get the same effect.

Except that then, with the current implementation, you're paying for the
higher HZ whenever the CPU is busy. I bet that doesn't take long to
overwhelm any added overhead in the hrtimer msleep().

In the end, I did this because I thought msleep() should do what it
claims to do, because I thought that getting a known-to-expire timeout
off the timer wheel made sense, and to make a tiny baby step in the
direction of reducing the use of jiffies in the core code.

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