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>] [day] [month] [year] [list]
Date:	Tue, 16 Aug 2011 23:14:38 -0700
From:	Da Zheng <zhengda1936@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: some confusion in timekeeping

Hello,

I try to understand the code in kernel/time/timekeeping.c, but it's very
confusing. The most confusing part is shift. I don't understand why we need
that? I notice that (clocksource.mult >> clocksource.shift) is the number of
nanoseconds for each cycle, but I don't see a point why shift should be used.
For example, the code below makes no sense to me. If clock->mult is the number
of nanoseconds for a cycle, then we don't need to shift `tmp'.
        tmp = NTP_INTERVAL_LENGTH;
        tmp <<= clock->shift;
        ntpinterval = tmp;
        tmp += clock->mult/2;
        do_div(tmp, clock->mult);

clocksource_jiffies uses 8 as the shift value, but I don't know why it is
chosen. clocks_calc_mult_shift() is used to calculate shift and mult, but I
don't understand how the algorithm works there. It seems there is very few
documents about timekeeping.c

Can anyone help me understand the code or point me to some documents?

Thanks a lot,
Da
--
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