/* * linux/kernel/hrtimer.c * * Copyright(C) 2005-2006, Thomas Gleixner <tglx@linutronix.de> * Copyright(C) 2005-2007, Red Hat, Inc., Ingo Molnar * Copyright(C) 2006-2007 Timesys Corp., Thomas Gleixner * * High-resolution kernel timers * * In contrast to the low-resolution timeout API implemented in * kernel/timer.c, hrtimers provide finer resolution and accuracy * depending on system configuration and capabilities. * * These timers are currently used for: * - itimers * - POSIX timers * - nanosleep * - precise in-kernel timing * * Started by: Thomas Gleixner and Ingo Molnar * * Credits: * based on kernel/timer.c * * Help, testing, suggestions, bugfixes, improvements were * provided by: * * George Anzinger, Andrew Morton, Steven Rostedt, Roman Zippel * et. al. * * For licencing details see kernel-base/COPYING */ #include <linux/cpu.h>#include <linux/module.h>#include <linux/percpu.h>#include <linux/hrtimer.h>#include <linux/notifier.h>#include <linux/syscalls.h>#include <linux/kallsyms.h>#include <linux/interrupt.h>#include <linux/tick.h>#include <linux/seq_file.h>#include <linux/err.h>#include <linux/debugobjects.h>#include <linux/sched.h>#include <linux/timer.h> #include <asm/uaccess.h> #include <trace/events/timer.h> /* * The timer bases: * * Note: If we want to add new timer bases, we have to skip the two * clock ids captured by the cpu-timers. We do this by holding empty * entries rather than doing math adjustment of the clock ids. * This ensures that we capture erroneous accesses to these clock ids * rather than moving them into the range of valid clock id's. */DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) ={ .clock_base = { { .index = CLOCK_REALTIME, .get_time = &ktime_get_real, .resolution = KTIME_LOW_RES, }, { .index = CLOCK_MONOTONIC, .get_time = &ktime_get, .resolution = KTIME_LOW_RES, }, }}; /* * Get the coarse grained time at the softirq based on xtime and * wall_to_monotonic. */static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base){ ktime_t xtim, tomono; struct timespec xts, tom; unsigned long seq; do { seq = read_seqbegin(&xtime_lock); xts = __current_kernel_time(); tom = __get_wall_to_monotonic(); } while (read_seqretry(&xtime_lock, seq)); xtim = timespec_to_ktime(xts); tomono = timespec_to_ktime(tom); base->clock_base[CLOCK_REALTIME].softirq_time = xtim; base->clock_base[CLOCK_MONOTONIC].softirq_time = ktime_add(xtim, tomono);} /* * Functions and macros which are different for UP/SMP systems are kept in a * single place */#ifdef CONFIG_SMP /* * We are using hashed locking: holding per_cpu(hrtimer_bases)[n].lock * means that all timers which are tied to this base via timer->base are * locked, and the base itself is locked too. * * So __run_timers/migrate_timers can safely modify all timers which could * be found on the lists/queues. * * When the timer's base is locked, and the timer removed from list, it is * possible to set timer->base = NULL and drop the lock: the timer remains * locked. */staticstruct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags){ struct hrtimer_clock_base *base; for (;;) { base = timer->base; if (likely(base != NULL)) { raw_spin_lock_irqsave(&base->cpu_base->lock, *flags); if (likely(base == timer->base)) return base; /* The timer has migrated to another CPU: */ raw_spin_unlock_irqrestore(&base->cpu_base->lock, *flags); } cpu_relax(); }} /* * Get the preferred target CPU for NOHZ */static int hrtimer_get_target(int this_cpu, int pinned){#ifdef CONFIG_NO_HZ if (!pinned && get_sysctl_timer_migration() && idle_cpu(this_cpu)) return get_nohz_timer_target();#endif return this_cpu;} /* * With HIGHRES=y we do not migrate the timer when it is expiring * before the next event on the target cpu because we cannot reprogram * the target cpu hardware and we would cause it to fire late. * * Called with cpu_base->lock of target cpu held. */static inthrtimer_check_target(struct hrtimer *timer, struct hrtimer_clock_base *new_base){#ifdef CONFIG_HIGH_RES_TIMERS ktime_t expires; if (!new_base->cpu_base->hres_active) return 0; expires = ktime_sub(hrtimer_get_expires(timer), new_base->offset); return expires.tv64 <= new_base->cpu_base->expires_next.tv64;#else return 0;#endif} /* * Switch the timer base to the current CPU when possible. */static inline struct hrtimer_clock_base *switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base, int pinned){ struct hrtimer_clock_base *new_base; struct hrtimer_cpu_base *new_cpu_base; int this_cpu = smp_processor_id(); int cpu = hrtimer_get_target(this_cpu, pinned); again: new_cpu_base = &per_cpu(hrtimer_bases, cpu); new_base = &new_cpu_base->clock_base[base->index]; if (base != new_base) { /* * We are trying to move timer to new_base. * However we can't change timer's base while it is running, * so we keep it on the same CPU. No hassle vs. reprogramming * the event source in the high resolution case. The softirq * code will take care of this when the timer function has * completed. There is no conflict as we hold the lock until * the timer is enqueued. */ if (unlikely(hrtimer_callback_running(timer))) return base; /* See the comment in lock_timer_base() */ timer->base = NULL; raw_spin_unlock(&base->cpu_base->lock); raw_spin_lock(&new_base->cpu_base->lock); if (cpu != this_cpu && hrtimer_check_target(timer, new_base)) { cpu = this_cpu; raw_spin_unlock(&new_base->cpu_base->lock); raw_spin_lock(&base->cpu_base->lock); timer->base = base; goto again; } timer->base = new_base; } return new_base;} #else /* CONFIG_SMP */ static inline struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags){ struct hrtimer_clock_base *base = timer->base; raw_spin_lock_irqsave(&base->cpu_base->lock, *flags); return base;} # define switch_hrtimer_base(t, b, p) (b) #endif /* !CONFIG_SMP */ /* * Functions for the union type storage format of ktime_t which are * too large for inlining: */#if BITS_PER_LONG < 64# ifndef CONFIG_KTIME_SCALAR/** * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable * @kt: addend * @nsec: the scalar nsec value to add * * Returns the sum of kt and nsec in ktime_t format */ktime_t ktime_add_ns(const ktime_t kt, u64 nsec){ ktime_t tmp; if (likely(nsec < NSEC_PER_SEC)) { tmp.tv64 = nsec; } else { unsigned long rem = do_div(nsec, NSEC_PER_SEC); tmp = ktime_set((long)nsec, rem); } return ktime_add(kt, tmp);} EXPORT_SYMBOL_GPL(ktime_add_ns); /** * ktime_sub_ns - Subtract a scalar nanoseconds value from a ktime_t variable * @kt: minuend * @nsec: the scalar nsec value to subtract * * Returns the subtraction of @nsec from @kt in ktime_t format */ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec){ ktime_t tmp; if (likely(nsec < NSEC_PER_SEC)) { tmp.tv64 = nsec; } else { unsigned long rem = do_div(nsec, NSEC_PER_SEC); tmp = ktime_set((long)nsec, rem); } return ktime_sub(kt, tmp);} EXPORT_SYMBOL_GPL(ktime_sub_ns);# endif /* !CONFIG_KTIME_SCALAR */ /* * Divide a ktime value by a nanosecond value */u64 ktime_divns(const ktime_t kt, s64 div){ u64 dclc; int sft = 0; dclc = ktime_to_ns(kt); /* Make sure the divisor is less than 2^32: */ while (div >> 32) { sft++; div >>= 1; } dclc >>= sft; do_div(dclc, (unsigned long) div); return dclc;}#endif /* BITS_PER_LONG >= 64 */ /* * Add two ktime values and do a safety check for overflow: */ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs){ ktime_t res = ktime_add(lhs, rhs); /* * We use KTIME_SEC_MAX here, the maximum timeout which we can * return to user space in a timespec: */ if (res.tv64 < 0 || res.tv64 < lhs.tv64 || res.tv64 < rhs.tv64) res = ktime_set(KTIME_SEC_MAX, 0); return res;} EXPORT_SYMBOL_GPL(ktime_add_safe); #ifdef CONFIG_DEBUG_OBJECTS_TIMERS static struct debug_obj_descr hrtimer_debug_descr; /* * fixup_init is called when: * - an active object is initialized */static int hrtimer_fixup_init(void *addr, enum debug_obj_state state){ struct hrtimer *timer = addr; switch (state) { case ODEBUG_STATE_ACTIVE: hrtimer_cancel(timer); debug_object_init(timer, &hrtimer_debug_descr); return 1; default: return 0; }} /* * fixup_activate is called when: * - an active object is activated * - an unknown object is activated (might be a statically initialized object) */static int hrtimer_fixup_activate(void *addr, enum debug_obj_state state){ switch (state) { case ODEBUG_STATE_NOTAVAILABLE: WARN_ON_ONCE(1); return 0; case ODEBUG_STATE_ACTIVE: WARN_ON(1); default: return 0; }} /* * fixup_free is called when: * - an active object is freed */static int hrtimer_fixup_free(void *addr, enum debug_obj_state state){ struct hrtimer *timer = addr; switch (state) { case ODEBUG_STATE_ACTIVE: hrtimer_cancel(timer); debug_object_free(timer, &hrtimer_debug_descr); return 1; default: return 0; }} static struct debug_obj_descr hrtimer_debug_descr = { .name = "hrtimer", .fixup_init = hrtimer_fixup_init, .fixup_activate = hrtimer_fixup_activate, .fixup_free = hrtimer_fixup_free,}; static inline void debug_hrtimer_init(struct hrtimer *timer){ debug_object_init(timer, &hrtimer_debug_descr);} static inline void debug_hrtimer_activate(struct hrtimer *timer){ debug_object_activate(timer, &hrtimer_debug_descr);} static inline void debug_hrtimer_deactivate(struct hrtimer *timer){ debug_object_deactivate(timer, &hrtimer_debug_descr);} static inline void debug_hrtimer_free(struct hrtimer *timer){ debug_object_free(timer, &hrtimer_debug_descr);} static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, enum hrtimer_mode mode); void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t clock_id, enum hrtimer_mode mode){ debug_object_init_on_stack(timer, &hrtimer_debug_descr); __hrtimer_init(timer, clock_id, mode);}EXPORT_SYMBOL_GPL(hrtimer_init_on_stack); void destroy_hrtimer_on_stack(struct hrtimer *timer){ debug_object_free(timer, &hrtimer_debug_descr);} #elsestatic inline void debug_hrtimer_init(struct hrtimer *timer) { }static inline void debug_hrtimer_activate(struct hrtimer *timer) { }static inline void debug_hrtimer_deactivate(struct hrtimer *timer) { }#endif static inline voiddebug_init(struct hrtimer *timer, clockid_t clockid, enum hrtimer_mode mode){ debug_hrtimer_init(timer); trace_hrtimer_init(timer, clockid, mode);} static inline void debug_activate(struct hrtimer *timer){ debug_hrtimer_activate(timer); trace_hrtimer_start(timer);} static inline void debug_deactivate(struct hrtimer *timer){ debug_hrtimer_deactivate(timer); trace_hrtimer_cancel(timer);} /* High resolution timer related functions */#ifdef CONFIG_HIGH_RES_TIMERS /* * High resolution timer enabled ? */static int hrtimer_hres_enabled __read_mostly = 1; /* * Enable / Disable high resolution mode */static int __init setup_hrtimer_hres(char *str){ if (!strcmp(str, "off")) hrtimer_hres_enabled = 0; else if (!strcmp(str, "on")) hrtimer_hres_enabled = 1; else return 0; return 1;} __setup("highres=", setup_hrtimer_hres); /* * hrtimer_high_res_enabled - query, if the highres mode is enabled */static inline int hrtimer_is_hres_enabled(void){ return hrtimer_hres_enabled;} /* * Is the high resolution mode active ? */static inline int hrtimer_hres_active(void){ return __get_cpu_var(hrtimer_bases).hres_active;Lines 1–500 of 1859. Load more
/* * linux/kernel/hrtimer.c * * Copyright(C) 2005-2006, Thomas Gleixner <tglx@linutronix.de> * Copyright(C) 2005-2007, Red Hat, Inc., Ingo Molnar * Copyright(C) 2006-2007 Timesys Corp., Thomas Gleixner * * High-resolution kernel timers * * In contrast to the low-resolution timeout API implemented in * kernel/timer.c, hrtimers provide finer resolution and accuracy * depending on system configuration and capabilities. * * These timers are currently used for: * - itimers * - POSIX timers * - nanosleep * - precise in-kernel timing * * Started by: Thomas Gleixner and Ingo Molnar * * Credits: * based on kernel/timer.c * * Help, testing, suggestions, bugfixes, improvements were * provided by: * * George Anzinger, Andrew Morton, Steven Rostedt, Roman Zippel * et. al. * * For licencing details see kernel-base/COPYING */ #include <linux/cpu.h> #include <linux/module.h> #include <linux/percpu.h> #include <linux/hrtimer.h> #include <linux/notifier.h> #include <linux/syscalls.h> #include <linux/kallsyms.h> #include <linux/interrupt.h> #include <linux/tick.h> #include <linux/seq_file.h> #include <linux/err.h> #include <linux/debugobjects.h> #include <linux/sched.h> #include <linux/timer.h> #include <asm/uaccess.h> #include <trace/events/timer.h> /* * The timer bases: * * Note: If we want to add new timer bases, we have to skip the two * clock ids captured by the cpu-timers. We do this by holding empty * entries rather than doing math adjustment of the clock ids. * This ensures that we capture erroneous accesses to these clock ids * rather than moving them into the range of valid clock id's. */ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = { .clock_base = { { .index = CLOCK_REALTIME, .get_time = &ktime_get_real, .resolution = KTIME_LOW_RES, }, { .index = CLOCK_MONOTONIC, .get_time = &ktime_get, .resolution = KTIME_LOW_RES, }, } }; /* * Get the coarse grained time at the softirq based on xtime and * wall_to_monotonic. */ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) { ktime_t xtim, tomono; struct timespec xts, tom; unsigned long seq; do { seq = read_seqbegin(&xtime_lock); xts = __current_kernel_time(); tom = __get_wall_to_monotonic(); } while (read_seqretry(&xtime_lock, seq)); xtim = timespec_to_ktime(xts); tomono = timespec_to_ktime(tom); base->clock_base[CLOCK_REALTIME].softirq_time = xtim; base->clock_base[CLOCK_MONOTONIC].softirq_time = ktime_add(xtim, tomono); } /* * Functions and macros which are different for UP/SMP systems are kept in a * single place */ #ifdef CONFIG_SMP /* * We are using hashed locking: holding per_cpu(hrtimer_bases)[n].lock * means that all timers which are tied to this base via timer->base are * locked, and the base itself is locked too. * * So __run_timers/migrate_timers can safely modify all timers which could * be found on the lists/queues. * * When the timer's base is locked, and the timer removed from list, it is * possible to set timer->base = NULL and drop the lock: the timer remains * locked. */ static struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) { struct hrtimer_clock_base *base; for (;;) { base = timer->base; if (likely(base != NULL)) { raw_spin_lock_irqsave(&base->cpu_base->lock, *flags); if (likely(base == timer->base)) return base; /* The timer has migrated to another CPU: */ raw_spin_unlock_irqrestore(&base->cpu_base->lock, *flags); } cpu_relax(); } } /* * Get the preferred target CPU for NOHZ */ static int hrtimer_get_target(int this_cpu, int pinned) { #ifdef CONFIG_NO_HZ if (!pinned && get_sysctl_timer_migration() && idle_cpu(this_cpu)) return get_nohz_timer_target(); #endif return this_cpu; } /* * With HIGHRES=y we do not migrate the timer when it is expiring * before the next event on the target cpu because we cannot reprogram * the target cpu hardware and we would cause it to fire late. * * Called with cpu_base->lock of target cpu held. */ static int hrtimer_check_target(struct hrtimer *timer, struct hrtimer_clock_base *new_base) { #ifdef CONFIG_HIGH_RES_TIMERS ktime_t expires; if (!new_base->cpu_base->hres_active) return 0; expires = ktime_sub(hrtimer_get_expires(timer), new_base->offset); return expires.tv64 <= new_base->cpu_base->expires_next.tv64; #else return 0; #endif } /* * Switch the timer base to the current CPU when possible. */ static inline struct hrtimer_clock_base * switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base, int pinned) { struct hrtimer_clock_base *new_base; struct hrtimer_cpu_base *new_cpu_base; int this_cpu = smp_processor_id(); int cpu = hrtimer_get_target(this_cpu, pinned); again: new_cpu_base = &per_cpu(hrtimer_bases, cpu); new_base = &new_cpu_base->clock_base[base->index]; if (base != new_base) { /* * We are trying to move timer to new_base. * However we can't change timer's base while it is running, * so we keep it on the same CPU. No hassle vs. reprogramming * the event source in the high resolution case. The softirq * code will take care of this when the timer function has * completed. There is no conflict as we hold the lock until * the timer is enqueued. */ if (unlikely(hrtimer_callback_running(timer))) return base; /* See the comment in lock_timer_base() */ timer->base = NULL; raw_spin_unlock(&base->cpu_base->lock); raw_spin_lock(&new_base->cpu_base->lock); if (cpu != this_cpu && hrtimer_check_target(timer, new_base)) { cpu = this_cpu; raw_spin_unlock(&new_base->cpu_base->lock); raw_spin_lock(&base->cpu_base->lock); timer->base = base; goto again; } timer->base = new_base; } return new_base; } #else /* CONFIG_SMP */ static inline struct hrtimer_clock_base * lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) { struct hrtimer_clock_base *base = timer->base; raw_spin_lock_irqsave(&base->cpu_base->lock, *flags); return base; } # define switch_hrtimer_base(t, b, p) (b) #endif /* !CONFIG_SMP */ /* * Functions for the union type storage format of ktime_t which are * too large for inlining: */ #if BITS_PER_LONG < 64 # ifndef CONFIG_KTIME_SCALAR /** * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable * @kt: addend * @nsec: the scalar nsec value to add * * Returns the sum of kt and nsec in ktime_t format */ ktime_t ktime_add_ns(const ktime_t kt, u64 nsec) { ktime_t tmp; if (likely(nsec < NSEC_PER_SEC)) { tmp.tv64 = nsec; } else { unsigned long rem = do_div(nsec, NSEC_PER_SEC); tmp = ktime_set((long)nsec, rem); } return ktime_add(kt, tmp); } EXPORT_SYMBOL_GPL(ktime_add_ns); /** * ktime_sub_ns - Subtract a scalar nanoseconds value from a ktime_t variable * @kt: minuend * @nsec: the scalar nsec value to subtract * * Returns the subtraction of @nsec from @kt in ktime_t format */ ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec) { ktime_t tmp; if (likely(nsec < NSEC_PER_SEC)) { tmp.tv64 = nsec; } else { unsigned long rem = do_div(nsec, NSEC_PER_SEC); tmp = ktime_set((long)nsec, rem); } return ktime_sub(kt, tmp); } EXPORT_SYMBOL_GPL(ktime_sub_ns); # endif /* !CONFIG_KTIME_SCALAR */ /* * Divide a ktime value by a nanosecond value */ u64 ktime_divns(const ktime_t kt, s64 div) { u64 dclc; int sft = 0; dclc = ktime_to_ns(kt); /* Make sure the divisor is less than 2^32: */ while (div >> 32) { sft++; div >>= 1; } dclc >>= sft; do_div(dclc, (unsigned long) div); return dclc; } #endif /* BITS_PER_LONG >= 64 */ /* * Add two ktime values and do a safety check for overflow: */ ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs) { ktime_t res = ktime_add(lhs, rhs); /* * We use KTIME_SEC_MAX here, the maximum timeout which we can * return to user space in a timespec: */ if (res.tv64 < 0 || res.tv64 < lhs.tv64 || res.tv64 < rhs.tv64) res = ktime_set(KTIME_SEC_MAX, 0); return res; } EXPORT_SYMBOL_GPL(ktime_add_safe); #ifdef CONFIG_DEBUG_OBJECTS_TIMERS static struct debug_obj_descr hrtimer_debug_descr; /* * fixup_init is called when: * - an active object is initialized */ static int hrtimer_fixup_init(void *addr, enum debug_obj_state state) { struct hrtimer *timer = addr; switch (state) { case ODEBUG_STATE_ACTIVE: hrtimer_cancel(timer); debug_object_init(timer, &hrtimer_debug_descr); return 1; default: return 0; } } /* * fixup_activate is called when: * - an active object is activated * - an unknown object is activated (might be a statically initialized object) */ static int hrtimer_fixup_activate(void *addr, enum debug_obj_state state) { switch (state) { case ODEBUG_STATE_NOTAVAILABLE: WARN_ON_ONCE(1); return 0; case ODEBUG_STATE_ACTIVE: WARN_ON(1); default: return 0; } } /* * fixup_free is called when: * - an active object is freed */ static int hrtimer_fixup_free(void *addr, enum debug_obj_state state) { struct hrtimer *timer = addr; switch (state) { case ODEBUG_STATE_ACTIVE: hrtimer_cancel(timer); debug_object_free(timer, &hrtimer_debug_descr); return 1; default: return 0; } } static struct debug_obj_descr hrtimer_debug_descr = { .name = "hrtimer", .fixup_init = hrtimer_fixup_init, .fixup_activate = hrtimer_fixup_activate, .fixup_free = hrtimer_fixup_free, }; static inline void debug_hrtimer_init(struct hrtimer *timer) { debug_object_init(timer, &hrtimer_debug_descr); } static inline void debug_hrtimer_activate(struct hrtimer *timer) { debug_object_activate(timer, &hrtimer_debug_descr); } static inline void debug_hrtimer_deactivate(struct hrtimer *timer) { debug_object_deactivate(timer, &hrtimer_debug_descr); } static inline void debug_hrtimer_free(struct hrtimer *timer) { debug_object_free(timer, &hrtimer_debug_descr); } static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, enum hrtimer_mode mode); void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t clock_id, enum hrtimer_mode mode) { debug_object_init_on_stack(timer, &hrtimer_debug_descr); __hrtimer_init(timer, clock_id, mode); } EXPORT_SYMBOL_GPL(hrtimer_init_on_stack); void destroy_hrtimer_on_stack(struct hrtimer *timer) { debug_object_free(timer, &hrtimer_debug_descr); } #else static inline void debug_hrtimer_init(struct hrtimer *timer) { } static inline void debug_hrtimer_activate(struct hrtimer *timer) { } static inline void debug_hrtimer_deactivate(struct hrtimer *timer) { } #endif static inline void debug_init(struct hrtimer *timer, clockid_t clockid, enum hrtimer_mode mode) { debug_hrtimer_init(timer); trace_hrtimer_init(timer, clockid, mode); } static inline void debug_activate(struct hrtimer *timer) { debug_hrtimer_activate(timer); trace_hrtimer_start(timer); } static inline void debug_deactivate(struct hrtimer *timer) { debug_hrtimer_deactivate(timer); trace_hrtimer_cancel(timer); } /* High resolution timer related functions */ #ifdef CONFIG_HIGH_RES_TIMERS /* * High resolution timer enabled ? */ static int hrtimer_hres_enabled __read_mostly = 1; /* * Enable / Disable high resolution mode */ static int __init setup_hrtimer_hres(char *str) { if (!strcmp(str, "off")) hrtimer_hres_enabled = 0; else if (!strcmp(str, "on")) hrtimer_hres_enabled = 1; else return 0; return 1; } __setup("highres=", setup_hrtimer_hres); /* * hrtimer_high_res_enabled - query, if the highres mode is enabled */ static inline int hrtimer_is_hres_enabled(void) { return hrtimer_hres_enabled; } /* * Is the high resolution mode active ? */ static inline int hrtimer_hres_active(void) { return __get_cpu_var(hrtimer_bases).hres_active;