The patch titled add an inlined version of iter_div_u64_rem has been added to the -mm tree. Its filename is add-an-inlined-version-of-iter_div_u64_rem.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: add an inlined version of iter_div_u64_rem From: Jeremy Fitzhardinge <jeremy@xxxxxxxx> iter_div_u64_rem is used in the x86-64 vdso, which cannot call other kernel code. For this case, provide the always_inlined version, __iter_div_u64_rem. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: john stultz <johnstul@xxxxxxxxxx> Cc: Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx> Cc: Christian Kujau <lists@xxxxxxxxxxxxxxx> Cc: Robert Hancock <hancockr@xxxxxxx> Cc: Andi Kleen <andi@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/math64.h | 19 +++++++++++++++++++ lib/div64.c | 15 +-------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff -puN include/linux/math64.h~add-an-inlined-version-of-iter_div_u64_rem include/linux/math64.h --- a/include/linux/math64.h~add-an-inlined-version-of-iter_div_u64_rem +++ a/include/linux/math64.h @@ -83,4 +83,23 @@ static inline s64 div_s64(s64 dividend, u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder); +static __always_inline u32 +__iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) +{ + u32 ret = 0; + + while (dividend >= divisor) { + /* The following asm() prevents the compiler from + optimising this loop into a modulo operation. */ + asm("" : "+rm"(dividend)); + + dividend -= divisor; + ret++; + } + + *remainder = dividend; + + return ret; +} + #endif /* _LINUX_MATH64_H */ diff -puN lib/div64.c~add-an-inlined-version-of-iter_div_u64_rem lib/div64.c --- a/lib/div64.c~add-an-inlined-version-of-iter_div_u64_rem +++ a/lib/div64.c @@ -105,19 +105,6 @@ EXPORT_SYMBOL(div64_u64); */ u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) { - u32 ret = 0; - - while (dividend >= divisor) { - /* The following asm() prevents the compiler from - optimising this loop into a modulo operation. */ - asm("" : "+rm"(dividend)); - - dividend -= divisor; - ret++; - } - - *remainder = dividend; - - return ret; + return __iter_div_u64_rem(dividend, divisor, remainder); } EXPORT_SYMBOL(iter_div_u64_rem); _ Patches currently in -mm which might be from jeremy@xxxxxxxx are x86-use-explicit-copy-in-vdso_gettimeofday.patch common-implementation-of-iterative-div-mod.patch add-an-inlined-version-of-iter_div_u64_rem.patch always_inline-timespec_add_ns.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html