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
| ||
|
Date: Mon, 9 Nov 2015 16:21:21 -0800 From: Jacob Pan <jacob.jun.pan@...ux.intel.com> To: Peter Zijlstra <peterz@...radead.org>, LKML <linux-kernel@...r.kernel.org> Cc: Rafael Wysocki <rafael.j.wysocki@...el.com>, Len Brown <len.brown@...el.com>, Andi Kleen <andi.kleen@...el.com>, Thomas Gleixner <tglx@...utronix.de>, Paul Turner <pjt@...gle.com>, Tim Chen <tim.c.chen@...ux.intel.com>, Dietmar Eggemann <dietmar.eggemann@....com>, Eduardo Valentin <edubezval@...il.com>, Punit Agrawal <punit.agrawal@....com>, Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>, Jacob Pan <jacob.jun.pan@...ux.intel.com> Subject: [RFC PATCH v2 1/3] ktime: add a roundup function ktime roundup function can be used to keep timer aligned and prevent drift for recurring timeouts. Signed-off-by: Jacob Pan <jacob.jun.pan@...ux.intel.com> --- include/linux/ktime.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/ktime.h b/include/linux/ktime.h index 2b6a204..2e293fa 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h @@ -233,6 +233,16 @@ static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec) extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); +static inline ktime_t ktime_roundup(ktime_t x, ktime_t y) +{ + u64 temp_tv64; + + temp_tv64 = x.tv64 + y.tv64 - 1; + temp_tv64 = div64_u64(temp_tv64, y.tv64); + x.tv64 = temp_tv64 * y.tv64; + + return x; +} /** * ktime_to_timespec_cond - convert a ktime_t variable to timespec * format only if the variable contains data -- 1.9.1 -- 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