diff --git a/[refs] b/[refs] index a4bc670599f8..c5dd6abc2b2b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5a1603be58f11edb1b30cb1e40cfbdd4439289d0 +refs/heads/master: 4d7365d664e79710ac0e782a23443471ddf05bdd diff --git a/trunk/arch/x86/xen/time.c b/trunk/arch/x86/xen/time.c index 52b2e3856980..c39e1a5aa241 100644 --- a/trunk/arch/x86/xen/time.c +++ b/trunk/arch/x86/xen/time.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -151,7 +150,11 @@ static void do_stolen_accounting(void) if (stolen < 0) stolen = 0; - ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen); + ticks = 0; + while (stolen >= NS_PER_TICK) { + ticks++; + stolen -= NS_PER_TICK; + } __get_cpu_var(residual_stolen) = stolen; account_steal_time(NULL, ticks); @@ -163,7 +166,11 @@ static void do_stolen_accounting(void) if (blocked < 0) blocked = 0; - ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked); + ticks = 0; + while (blocked >= NS_PER_TICK) { + ticks++; + blocked -= NS_PER_TICK; + } __get_cpu_var(residual_blocked) = blocked; account_steal_time(idle_task(smp_processor_id()), ticks); } diff --git a/trunk/drivers/video/fsl-diu-fb.c b/trunk/drivers/video/fsl-diu-fb.c index 0a2785361ca3..b50bb03cb5ab 100644 --- a/trunk/drivers/video/fsl-diu-fb.c +++ b/trunk/drivers/video/fsl-diu-fb.c @@ -1320,7 +1320,7 @@ static void free_irq_local(int irq) * Power management hooks. Note that we won't be called from IRQ context, * unlike the blank functions above, so we may sleep. */ -static int fsl_diu_suspend(struct of_device *ofdev, pm_message_t state) +static int fsl_diu_suspend(struct of_device *dev, pm_message_t state) { struct fsl_diu_data *machine_data; @@ -1330,7 +1330,7 @@ static int fsl_diu_suspend(struct of_device *ofdev, pm_message_t state) return 0; } -static int fsl_diu_resume(struct of_device *ofdev) +static int fsl_diu_resume(struct of_device *dev) { struct fsl_diu_data *machine_data; diff --git a/trunk/include/linux/math64.h b/trunk/include/linux/math64.h index c87f1528703a..c1a5f81501ff 100644 --- a/trunk/include/linux/math64.h +++ b/trunk/include/linux/math64.h @@ -81,25 +81,4 @@ static inline s64 div_s64(s64 dividend, s32 divisor) } #endif -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 --git a/trunk/include/linux/time.h b/trunk/include/linux/time.h index e15206a7e82e..d32ef0ad4c0a 100644 --- a/trunk/include/linux/time.h +++ b/trunk/include/linux/time.h @@ -6,7 +6,6 @@ #ifdef __KERNEL__ # include # include -# include #endif #ifndef _STRUCT_TIMESPEC @@ -170,13 +169,18 @@ extern struct timeval ns_to_timeval(const s64 nsec); * timespec_add_ns - Adds nanoseconds to a timespec * @a: pointer to timespec to be incremented * @ns: unsigned nanoseconds value to be added - * - * This must always be inlined because its used from the x86-64 vdso, - * which cannot call other kernel functions. */ -static __always_inline void timespec_add_ns(struct timespec *a, u64 ns) +static inline void timespec_add_ns(struct timespec *a, u64 ns) { - a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns); + ns += a->tv_nsec; + while(unlikely(ns >= NSEC_PER_SEC)) { + /* The following asm() prevents the compiler from + * optimising this loop into a modulo operation. */ + asm("" : "+r"(ns)); + + ns -= NSEC_PER_SEC; + a->tv_sec++; + } a->tv_nsec = ns; } #endif /* __KERNEL__ */ diff --git a/trunk/lib/div64.c b/trunk/lib/div64.c index a111eb8de9cf..bb5bd0c0f030 100644 --- a/trunk/lib/div64.c +++ b/trunk/lib/div64.c @@ -98,13 +98,3 @@ EXPORT_SYMBOL(div64_u64); #endif #endif /* BITS_PER_LONG == 32 */ - -/* - * Iterative div/mod for use when dividend is not expected to be much - * bigger than divisor. - */ -u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) -{ - return __iter_div_u64_rem(dividend, divisor, remainder); -} -EXPORT_SYMBOL(iter_div_u64_rem); diff --git a/trunk/mm/nommu.c b/trunk/mm/nommu.c index 4462b6a3fcb9..3abd0845bda4 100644 --- a/trunk/mm/nommu.c +++ b/trunk/mm/nommu.c @@ -104,15 +104,21 @@ EXPORT_SYMBOL(vmtruncate); unsigned int kobjsize(const void *objp) { struct page *page; + int order = 0; /* * If the object we have should not have ksize performed on it, * return size of 0 */ - if (!objp || !virt_addr_valid(objp)) + if (!objp) + return 0; + + if ((unsigned long)objp >= memory_end) return 0; page = virt_to_head_page(objp); + if (!page) + return 0; /* * If the allocator sets PageSlab, we know the pointer came from @@ -123,9 +129,18 @@ unsigned int kobjsize(const void *objp) /* * The ksize() function is only guaranteed to work for pointers - * returned by kmalloc(). So handle arbitrary pointers here. + * returned by kmalloc(). So handle arbitrary pointers, that we expect + * always to be compound pages, here. + */ + if (PageCompound(page)) + order = compound_order(page); + + /* + * Finally, handle arbitrary pointers that don't set PageSlab. + * Default to 0-order in the case when we're unable to ksize() + * the object. */ - return PAGE_SIZE << compound_order(page); + return PAGE_SIZE << order; } /* diff --git a/trunk/scripts/mod/modpost.c b/trunk/scripts/mod/modpost.c index 508c5895c680..a07f91aac920 100644 --- a/trunk/scripts/mod/modpost.c +++ b/trunk/scripts/mod/modpost.c @@ -467,6 +467,25 @@ static void parse_elf_finish(struct elf_info *info) release_file(info->hdr, info->size); } +static int ignore_undef_symbol(struct elf_info *info, const char *symname) +{ + /* ignore __this_module, it will be resolved shortly */ + if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0) + return 1; + /* ignore global offset table */ + if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0) + return 1; + if (info->hdr->e_machine == EM_PPC) + /* Special register function linked on all modules during final link of .ko */ + if (strncmp(symname, "_restgpr_", sizeof("_restgpr_") - 1) == 0 || + strncmp(symname, "_savegpr_", sizeof("_savegpr_") - 1) == 0 || + strncmp(symname, "_rest32gpr_", sizeof("_rest32gpr_") - 1) == 0 || + strncmp(symname, "_save32gpr_", sizeof("_save32gpr_") - 1) == 0) + return 1; + /* Do not ignore this symbol */ + return 0; +} + #define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_" #define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_" @@ -493,11 +512,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL && ELF_ST_BIND(sym->st_info) != STB_WEAK) break; - /* ignore global offset table */ - if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0) - break; - /* ignore __this_module, it will be resolved shortly */ - if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0) + if (ignore_undef_symbol(info, symname)) break; /* cope with newer glibc (2.3.4 or higher) STT_ definition in elf.h */ #if defined(STT_REGISTER) || defined(STT_SPARC_REGISTER)