Hey Arnd, On Thu, Jun 13, 2019 at 5:40 PM Arnd Bergmann <a...@arndb.de> wrote: > A seqlock is a very cheap synchronization primitive, I would actually > guess that this is faster than most implementations of sched_clock() > that access a hardware register for reading the time.
It appears to me that ktime_get_coarse_boottime() has a granularity of a whole second, which is a lot worse than jiffies. Looking at the source, you assign base but don't then add ns like the other functions. At first I thought this was an intentional quirk to avoid hitting the slow hardware paths. But noticing this poor granularity now and observing that there's actually a blank line (\n\n) where the nanosecond addition normally would be, I wonder if something was lost in cut-and-paste? I'm still poking around trying to see what's up. As a quick test, running this on every packet during a high speed test shows the left incrementing many times per second, whereas the right increments once per second: static int x = 0; if (!(x++ % 30000)) pr_err("%llu %llu\n", local_clock(), ktime_get_coarse_boottime()); Jason