cregit-Linux how code gets into the kernel

Release 4.16 kernel/time/hrtimer.c

Directory: kernel/time
/*
 *  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/export.h>
#include <linux/percpu.h>
#include <linux/hrtimer.h>
#include <linux/notifier.h>
#include <linux/syscalls.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/signal.h>
#include <linux/sched/sysctl.h>
#include <linux/sched/rt.h>
#include <linux/sched/deadline.h>
#include <linux/sched/nohz.h>
#include <linux/sched/debug.h>
#include <linux/timer.h>
#include <linux/freezer.h>
#include <linux/compat.h>

#include <linux/uaccess.h>

#include <trace/events/timer.h>

#include "tick-internal.h"

/*
 * Masks for selecting the soft and hard context timers from
 * cpu_base->active
 */

#define MASK_SHIFT		(HRTIMER_BASE_MONOTONIC_SOFT)

#define HRTIMER_ACTIVE_HARD	((1U << MASK_SHIFT) - 1)

#define HRTIMER_ACTIVE_SOFT	(HRTIMER_ACTIVE_HARD << MASK_SHIFT)

#define HRTIMER_ACTIVE_ALL	(HRTIMER_ACTIVE_SOFT | HRTIMER_ACTIVE_HARD)

/*
 * The timer bases:
 *
 * There are more clockids than hrtimer bases. Thus, we index
 * into the timer bases by the hrtimer_base_type enum. When trying
 * to reach a base using a clockid, hrtimer_clockid_to_base()
 * is used to convert from clockid to the proper hrtimer_base_type.
 */
DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
{
	.lock = __RAW_SPIN_LOCK_UNLOCKED(hrtimer_bases.lock),
	.clock_base =
	{
		{
			.index = HRTIMER_BASE_MONOTONIC,
			.clockid = CLOCK_MONOTONIC,
			.get_time = &ktime_get,
                },
		{
			.index = HRTIMER_BASE_REALTIME,
			.clockid = CLOCK_REALTIME,
			.get_time = &ktime_get_real,
                },
		{
			.index = HRTIMER_BASE_BOOTTIME,
			.clockid = CLOCK_BOOTTIME,
			.get_time = &ktime_get_boottime,
                },
		{
			.index = HRTIMER_BASE_TAI,
			.clockid = CLOCK_TAI,
			.get_time = &ktime_get_clocktai,
                },
		{
			.index = HRTIMER_BASE_MONOTONIC_SOFT,
			.clockid = CLOCK_MONOTONIC,
			.get_time = &ktime_get,
                },
		{
			.index = HRTIMER_BASE_REALTIME_SOFT,
			.clockid = CLOCK_REALTIME,
			.get_time = &ktime_get_real,
                },
		{
			.index = HRTIMER_BASE_BOOTTIME_SOFT,
			.clockid = CLOCK_BOOTTIME,
			.get_time = &ktime_get_boottime,
                },
		{
			.index = HRTIMER_BASE_TAI_SOFT,
			.clockid = CLOCK_TAI,
			.get_time = &ktime_get_clocktai,
                },
        }
};


static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = {
	/* Make sure we catch unsupported clockids */
	[0 ... MAX_CLOCKS - 1]	= HRTIMER_MAX_CLOCK_BASES,

	[CLOCK_REALTIME]	= HRTIMER_BASE_REALTIME,
	[CLOCK_MONOTONIC]	= HRTIMER_BASE_MONOTONIC,
	[CLOCK_BOOTTIME]	= HRTIMER_BASE_BOOTTIME,
	[CLOCK_TAI]		= HRTIMER_BASE_TAI,
};

/*
 * Functions and macros which are different for UP/SMP systems are kept in a
 * single place
 */
#ifdef CONFIG_SMP

/*
 * We require the migration_base for lock_hrtimer_base()/switch_hrtimer_base()
 * such that hrtimer_callback_running() can unconditionally dereference
 * timer->base->cpu_base
 */

static struct hrtimer_cpu_base migration_cpu_base = {
	.clock_base = { { .cpu_base = &migration_cpu_base, }, },
};


#define migration_base	migration_cpu_base.clock_base[0]

/*
 * 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 = &migration_base 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 != &migration_base)) { 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(); } }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner9197.85%375.00%
Peter Zijlstra22.15%125.00%
Total93100.00%4100.00%

/* * We do not migrate the timer when it is expiring before the next * event on the target cpu. When high resolution is enabled, we cannot * reprogram the target cpu hardware and we would cause it to fire * late. To keep it simple, we handle the high resolution enabled and * disabled case similar. * * Called with cpu_base->lock of target cpu held. */
static int hrtimer_check_target(struct hrtimer *timer, struct hrtimer_clock_base *new_base) { ktime_t expires; expires = ktime_sub(hrtimer_get_expires(timer), new_base->offset); return expires < new_base->cpu_base->expires_next; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner4197.62%150.00%
Anna-Maria Gleixner12.38%150.00%
Total42100.00%2100.00%


static inline struct hrtimer_cpu_base *get_target_base(struct hrtimer_cpu_base *base, int pinned) { #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) if (static_branch_likely(&timers_migration_enabled) && !pinned) return &per_cpu(hrtimer_bases, get_nohz_timer_target()); #endif return base; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner5398.15%266.67%
Frédéric Weisbecker11.85%133.33%
Total54100.00%3100.00%

/* * We switch the timer base to a power-optimized selected CPU target, * if: * - NO_HZ_COMMON is enabled * - timer migration is enabled * - the timer callback is not running * - the timer is not the first expiring timer on the new target * * If one of the above requirements is not fulfilled we move the timer * to the current CPU or leave it on the previously assigned CPU if * the timer callback is currently running. */
static inline struct hrtimer_clock_base * switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base, int pinned) { struct hrtimer_cpu_base *new_cpu_base, *this_cpu_base; struct hrtimer_clock_base *new_base; int basenum = base->index; this_cpu_base = this_cpu_ptr(&hrtimer_bases); new_cpu_base = get_target_base(this_cpu_base, pinned); again: new_base = &new_cpu_base->clock_base[basenum]; 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_hrtimer_base() */ timer->base = &migration_base; raw_spin_unlock(&base->cpu_base->lock); raw_spin_lock(&new_base->cpu_base->lock); if (new_cpu_base != this_cpu_base && hrtimer_check_target(timer, new_base)) { raw_spin_unlock(&new_base->cpu_base->lock); raw_spin_lock(&base->cpu_base->lock); new_cpu_base = this_cpu_base; timer->base = base; goto again; } timer->base = new_base; } else { if (new_cpu_base != this_cpu_base && hrtimer_check_target(timer, new_base)) { new_cpu_base = this_cpu_base; goto again; } } return new_base; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner12159.61%646.15%
Arun R Bharadwaj4120.20%215.38%
Leon Ma2110.34%17.69%
John Stultz83.94%17.69%
Frédéric Weisbecker73.45%17.69%
Peter Zijlstra31.48%17.69%
Jan Blunck20.99%17.69%
Total203100.00%13100.00%

#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; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner45100.00%3100.00%
Total45100.00%3100.00%

# 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 /* * Divide a ktime value by a nanosecond value */
s64 __ktime_divns(const ktime_t kt, s64 div) { int sft = 0; s64 dclc; u64 tmp; dclc = ktime_to_ns(kt); tmp = dclc < 0 ? -dclc : dclc; /* Make sure the divisor is less than 2^32: */ while (div >> 32) { sft++; div >>= 1; } tmp >>= sft; do_div(tmp, (unsigned long) div); return dclc < 0 ? -tmp : tmp; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner5364.63%125.00%
John Stultz2732.93%125.00%
Nico Pitre11.22%125.00%
Roman Zippel11.22%125.00%
Total82100.00%4100.00%

EXPORT_SYMBOL_GPL(__ktime_divns); #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_unsafe(lhs, rhs); /* * We use KTIME_SEC_MAX here, the maximum timeout which we can * return to user space in a timespec: */ if (res < 0 || res < lhs || res < rhs) res = ktime_set(KTIME_SEC_MAX, 0); return res; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner4998.00%266.67%
Vegard Nossum12.00%133.33%
Total50100.00%3100.00%

EXPORT_SYMBOL_GPL(ktime_add_safe); #ifdef CONFIG_DEBUG_OBJECTS_TIMERS static struct debug_obj_descr hrtimer_debug_descr;
static void *hrtimer_debug_hint(void *addr) { return ((struct hrtimer *) addr)->function; }

Contributors

PersonTokensPropCommitsCommitProp
Stanislaw Gruszka23100.00%1100.00%
Total23100.00%1100.00%

/* * fixup_init is called when: * - an active object is initialized */
static bool 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 true; default: return false; } }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner4794.00%150.00%
Changbin Du36.00%150.00%
Total50100.00%2100.00%

/* * fixup_activate is called when: * - an active object is activated * - an unknown non-static object is activated */
static bool hrtimer_fixup_activate(void *addr, enum debug_obj_state state) { switch (state) { case ODEBUG_STATE_ACTIVE: WARN_ON(1); default: return false; } }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner3093.75%150.00%
Changbin Du26.25%150.00%
Total32100.00%2100.00%

/* * fixup_free is called when: * - an active object is freed */
static bool 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 true; default: return false; } }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner4794.00%150.00%
Changbin Du36.00%150.00%
Total50100.00%2100.00%

static struct debug_obj_descr hrtimer_debug_descr = { .name = "hrtimer", .debug_hint = hrtimer_debug_hint, .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); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner20100.00%1100.00%
Total20100.00%1100.00%


static inline void debug_hrtimer_activate(struct hrtimer *timer, enum hrtimer_mode mode) { debug_object_activate(timer, &hrtimer_debug_descr); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner2083.33%150.00%
Anna-Maria Gleixner416.67%150.00%
Total24100.00%2100.00%


static inline void debug_hrtimer_deactivate(struct hrtimer *timer) { debug_object_deactivate(timer, &hrtimer_debug_descr); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner20100.00%1100.00%
Total20100.00%1100.00%


static inline void debug_hrtimer_free(struct hrtimer *timer) { debug_object_free(timer, &hrtimer_debug_descr); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner20100.00%1100.00%
Total20100.00%1100.00%

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); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner34100.00%2100.00%
Total34100.00%2100.00%

EXPORT_SYMBOL_GPL(hrtimer_init_on_stack);
void destroy_hrtimer_on_stack(struct hrtimer *timer) { debug_object_free(timer, &hrtimer_debug_descr); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner18100.00%2100.00%
Total18100.00%2100.00%

EXPORT_SYMBOL_GPL(destroy_hrtimer_on_stack); #else
static inline void debug_hrtimer_init(struct hrtimer *timer) { }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner11100.00%1100.00%
Total11100.00%1100.00%


static inline void debug_hrtimer_activate(struct hrtimer *timer, enum hrtimer_mode mode) { }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner1173.33%150.00%
Anna-Maria Gleixner426.67%150.00%
Total15100.00%2100.00%


static inline void debug_hrtimer_deactivate(struct hrtimer *timer) { }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner11100.00%1100.00%
Total11100.00%1100.00%

#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); }

Contributors

PersonTokensPropCommitsCommitProp
Xiao Guangrong33100.00%1100.00%
Total33100.00%1100.00%


static inline void debug_activate(struct hrtimer *timer, enum hrtimer_mode mode) { debug_hrtimer_activate(timer, mode); trace_hrtimer_start(timer, mode); }

Contributors

PersonTokensPropCommitsCommitProp
Xiao Guangrong2273.33%133.33%
Anna-Maria Gleixner826.67%266.67%
Total30100.00%3100.00%


static inline void debug_deactivate(struct hrtimer *timer) { debug_hrtimer_deactivate(timer); trace_hrtimer_cancel(timer); }

Contributors

PersonTokensPropCommitsCommitProp
Xiao Guangrong22100.00%1100.00%
Total22100.00%1100.00%


static struct hrtimer_clock_base * __next_base(struct hrtimer_cpu_base *cpu_base, unsigned int *active) { unsigned int idx; if (!*active) return NULL; idx = __ffs(*active); *active &= ~(1U << idx); return &cpu_base->clock_base[idx]; }

Contributors

PersonTokensPropCommitsCommitProp
Anna-Maria Gleixner58100.00%1100.00%
Total58100.00%1100.00%

#define for_each_active_base(base, cpu_base, active) \ while ((base = __next_base((cpu_base), &(active))))
static ktime_t __hrtimer_next_event_base(struct hrtimer_cpu_base *cpu_base, unsigned int active, ktime_t expires_next) { struct hrtimer_clock_base *base; ktime_t expires; for_each_active_base(base, cpu_base, active) { struct timerqueue_node *next; struct hrtimer *timer; next = timerqueue_getnext(&base->active); timer = container_of(next, struct hrtimer, node); expires = ktime_sub(hrtimer_get_expires(timer), base->offset); if (expires < expires_next) { expires_next = expires; if (timer->is_soft) cpu_base->softirq_next_timer = timer; else cpu_base->next_timer = timer; } } /* * clock_was_set() might have changed base->offset of any of * the clock bases so the result might be negative. Fix it up * to prevent a false positive in clockevents_program_event(). */ if (expires_next < 0) expires_next = 0; return expires_next; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner9474.02%337.50%
Anna-Maria Gleixner3225.20%450.00%
Fengguang Wu10.79%112.50%
Total127100.00%8100.00%

/* * Recomputes cpu_base::*next_timer and returns the earliest expires_next but * does not set cpu_base::*expires_next, that is done by hrtimer_reprogram. * * When a softirq is pending, we can ignore the HRTIMER_ACTIVE_SOFT bases, * those timers will get run whenever the softirq gets handled, at the end of * hrtimer_run_softirq(), hrtimer_update_softirq_timer() will re-add these bases. * * Therefore softirq values are those from the HRTIMER_ACTIVE_SOFT clock bases. * The !softirq values are the minima across HRTIMER_ACTIVE_ALL, unless an actual * softirq is pending, in which case they're the minima of HRTIMER_ACTIVE_HARD. * * @active_mask must be one of: * - HRTIMER_ACTIVE_ALL, * - HRTIMER_ACTIVE_SOFT, or * - HRTIMER_ACTIVE_HARD. */
static ktime_t __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base, unsigned int active_mask) { unsigned int active; struct hrtimer *next_timer = NULL; ktime_t expires_next = KTIME_MAX; if (!cpu_base->softirq_activated && (active_mask & HRTIMER_ACTIVE_SOFT)) { active = cpu_base->active_bases & HRTIMER_ACTIVE_SOFT; cpu_base->softirq_next_timer = NULL; expires_next = __hrtimer_next_event_base(cpu_base, active, KTIME_MAX); next_timer = cpu_base->softirq_next_timer; } if (active_mask & HRTIMER_ACTIVE_HARD) { active = cpu_base->active_bases & HRTIMER_ACTIVE_HARD; cpu_base->next_timer = next_timer; expires_next = __hrtimer_next_event_base(cpu_base, active, expires_next); } return expires_next; }

Contributors

PersonTokensPropCommitsCommitProp
Anna-Maria Gleixner113100.00%3100.00%
Total113100.00%3100.00%


static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base) { ktime_t *offs_real = &base->clock_base[HRTIMER_BASE_REALTIME].offset; ktime_t *offs_boot = &base->clock_base[HRTIMER_BASE_BOOTTIME].offset; ktime_t *offs_tai = &base->clock_base[HRTIMER_BASE_TAI].offset; ktime_t now = ktime_get_update_offsets_now(&base->clock_was_set_seq, offs_real, offs_boot, offs_tai); base->clock_base[HRTIMER_BASE_REALTIME_SOFT].offset = *offs_real; base->clock_base[HRTIMER_BASE_BOOTTIME_SOFT].offset = *offs_boot; base->clock_base[HRTIMER_BASE_TAI_SOFT].offset = *offs_tai; return now; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner6861.82%266.67%
Anna-Maria Gleixner4238.18%133.33%
Total110100.00%3100.00%

/* * Is the high resolution mode active ? */
static inline int __hrtimer_hres_active(struct hrtimer_cpu_base *cpu_base) { return IS_ENABLED(CONFIG_HIGH_RES_TIMERS) ? cpu_base->hres_active : 0; }

Contributors

PersonTokensPropCommitsCommitProp
Anna-Maria Gleixner24100.00%1100.00%
Total24100.00%1100.00%


static inline int hrtimer_hres_active(void) { return __hrtimer_hres_active(this_cpu_ptr(&hrtimer_bases)); }

Contributors

PersonTokensPropCommitsCommitProp
Anna-Maria Gleixner19100.00%1100.00%
Total19100.00%1100.00%

/* * Reprogram the event source with checking both queues for the * next event * Called with interrupts disabled and base->lock held */
static void hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base, int skip_equal) { ktime_t expires_next; /* * Find the current next expiration time. */ expires_next = __hrtimer_get_next_event(cpu_base, HRTIMER_ACTIVE_ALL); if (cpu_base->next_timer && cpu_base->next_timer->is_soft) { /* * When the softirq is activated, hrtimer has to be * programmed with the first hard hrtimer because soft * timer interrupt could occur too late. */ if (cpu_base->softirq_activated) expires_next = __hrtimer_get_next_event(cpu_base, HRTIMER_ACTIVE_HARD); else cpu_base->softirq_expires_next = expires_next; } if (skip_equal && expires_next == cpu_base->expires_next) return; cpu_base->expires_next = expires_next; /* * If hres is not active, hardware does not have to be * reprogrammed yet. * * If a hang was detected in the last timer interrupt then we * leave the hang delay active in the hardware. We want the * system to make progress. That also prevents the following * scenario: * T1 expires 50ms from now * T2 expires 5s from now * * T1 is removed, so this code is called and would reprogram * the hardware to 5s from now. Any hrtimer_start after that * will not reprogram the hardware due to hang_detected being * set. So we'd effectivly block all timers until the T2 event * fires. */ if (!__hrtimer_hres_active(cpu_base) || cpu_base->hang_detected) return; tick_program_event(cpu_base->expires_next, 1); }

Contributors

PersonTokensPropCommitsCommitProp
Anna-Maria Gleixner104100.00%4100.00%
Total104100.00%4100.00%

/* High resolution timer related functions */ #ifdef CONFIG_HIGH_RES_TIMERS /* * High resolution timer enabled ? */ static bool hrtimer_hres_enabled __read_mostly = true; unsigned int hrtimer_resolution __read_mostly = LOW_RES_NSEC; EXPORT_SYMBOL_GPL(hrtimer_resolution); /* * Enable / Disable high resolution mode */
static int __init setup_hrtimer_hres(char *str) { return (kstrtobool(str, &hrtimer_hres_enabled) == 0); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner1875.00%266.67%
Kees Cook625.00%133.33%
Total24100.00%3100.00%

__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; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner12100.00%2100.00%
Total12100.00%2100.00%

/* * Retrigger next event is called after clock was set * * Called with interrupts disabled via on_each_cpu() */
static void retrigger_next_event(void *arg) { struct hrtimer_cpu_base *base = this_cpu_ptr(&hrtimer_bases); if (!__hrtimer_hres_active(base)) return; raw_spin_lock(&base->lock); hrtimer_update_base(base); hrtimer_force_reprogram(base, 0); raw_spin_unlock(&base->lock); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner5289.66%350.00%
Anna-Maria Gleixner35.17%116.67%
Christoph Lameter23.45%116.67%
John Stultz11.72%116.67%
Total58100.00%6100.00%

/* * Switch to high resolution mode */
static void hrtimer_switch_to_hres(void) { struct hrtimer_cpu_base *base = this_cpu_ptr(&hrtimer_bases); if (tick_init_highres()) { printk(KERN_WARNING "Could not switch to high resolution " "mode on CPU %d\n", base->cpu); return; } base->hres_active = 1; hrtimer_resolution = HIGH_RES_NSEC; tick_setup_sched_timer(); /* "Retrigger" the interrupt to get things going */ retrigger_next_event(NULL); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner4680.70%350.00%
Ingo Molnar915.79%116.67%
Luiz Fernando N. Capitulino11.75%116.67%
Guenter Roeck11.75%116.67%
Total57100.00%6100.00%


static void clock_was_set_work(struct work_struct *work) { clock_was_set(); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner14100.00%1100.00%
Total14100.00%1100.00%

static DECLARE_WORK(hrtimer_work, clock_was_set_work); /* * Called from timekeeping and resume code to reprogram the hrtimer * interrupt device on all cpus. */
void clock_was_set_delayed(void) { schedule_work(&hrtimer_work); }

Contributors

PersonTokensPropCommitsCommitProp
John Stultz1076.92%150.00%
Thomas Gleixner323.08%150.00%
Total13100.00%2100.00%

#else
static inline int hrtimer_is_hres_enabled(void) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner12100.00%1100.00%
Total12100.00%1100.00%


static inline void hrtimer_switch_to_hres(void) { }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner675.00%150.00%
Luiz Fernando N. Capitulino225.00%150.00%
Total8100.00%2100.00%


static inline void retrigger_next_event(void *arg) { }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner10100.00%2100.00%
Total10100.00%2100.00%

#endif /* CONFIG_HIGH_RES_TIMERS */ /* * When a timer is enqueued and expires earlier than the already enqueued * timers, we have to check, whether it expires earlier than the timer for * which the clock event device was armed. * * Called with interrupts disabled and base->cpu_base.lock held */
static void hrtimer_reprogram(struct hrtimer *timer, bool reprogram) { struct hrtimer_cpu_base *cpu_base = this_cpu_ptr(&hrtimer_bases); struct hrtimer_clock_base *base = timer->base; ktime_t expires = ktime_sub(hrtimer_get_expires(timer), base->offset); WARN_ON_ONCE(hrtimer_get_expires_tv64(timer) < 0); /* * CLOCK_REALTIME timer might be requested with an absolute * expiry time which is less than base->offset. Set it to 0. */ if (expires < 0) expires = 0; if (timer->is_soft) { /* * soft hrtimer could be started on a remote CPU. In this * case softirq_expires_next needs to be updated on the * remote CPU. The soft hrtimer will not expire before the * first hard hrtimer on the remote CPU - * hrtimer_check_target() prevents this case. */ struct hrtimer_cpu_base *timer_cpu_base = base->cpu_base; if (timer_cpu_base->softirq_activated) return; if (!ktime_before(expires, timer_cpu_base->softirq_expires_next)) return; timer_cpu_base->softirq_next_timer = timer; timer_cpu_base->softirq_expires_next = expires; if (!ktime_before(expires, timer_cpu_base->expires_next) || !reprogram) return; } /* * If the timer is not on the current cpu, we cannot reprogram * the other cpus clock event device. */ if (base->cpu_base != cpu_base) return; /* * If the hrtimer interrupt is running, then it will * reevaluate the clock bases and reprogram the clock event * device. The callbacks are always executed in hard interrupt * context so we don't need an extra check for a running * callback. */ if (cpu_base->in_hrtirq) return; if (expires >= cpu_base->expires_next) return; /* Update the pointer to the next expiring timer */ cpu_base->next_timer = timer; cpu_base->expires_next = expires; /* * If hres is not active, hardware does not have to be * programmed yet. * * If a hang was detected in the last timer interrupt then we * do not schedule a timer which is earlier than the expiry * which we enforced in the hang detection. We want the system * to make progress. */ if (!__hrtimer_hres_active(cpu_base) || cpu_base->hang_detected) return; /* * Program the timer hardware. We enforce the expiry for * events which are already in the past. */ tick_program_event(expires, 1); }

Contributors

PersonTokensPropCommitsCommitProp
Anna-Maria Gleixner198100.00%4100.00%
Total198100.00%4100.00%

/* * Clock realtime was set * * Change the offset of the realtime clock vs. the monotonic * clock. * * We might have to reprogram the high resolution timer interrupt. On * SMP we call the architecture specific code to retrigger _all_ high * resolution timer interrupts. On UP we just disable interrupts and * call the high resolution interrupt code. */
void clock_was_set(void) { #ifdef CONFIG_HIGH_RES_TIMERS /* Retrigger the CPU local events everywhere */ on_each_cpu(retrigger_next_event, NULL, 1); #endif timerfd_clock_was_set(); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner25100.00%3100.00%
Total25100.00%3100.00%

/* * During resume we might have to reprogram the high resolution timer * interrupt on all online CPUs. However, all other CPUs will be * stopped with IRQs interrupts disabled so the clock_was_set() call * must be deferred. */
void hrtimers_resume(void) { lockdep_assert_irqs_disabled(); /* Retrigger on the local CPU */ retrigger_next_event(NULL); /* And schedule a retrigger for all others */ clock_was_set_delayed(); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner1995.00%375.00%
Frédéric Weisbecker15.00%125.00%
Total20100.00%4100.00%

/* * Counterpart to lock_hrtimer_base above: */
static inline void unlock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) { raw_spin_unlock_irqrestore(&timer->base->cpu_base->lock, *flags); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner33100.00%2100.00%
Total33100.00%2100.00%

/** * hrtimer_forward - forward the timer expiry * @timer: hrtimer to forward * @now: forward past this time * @interval: the interval to forward * * Forward the timer expiry so it will expire in the future. * Returns the number of overruns. * * Can be safely called from the callback function of @timer. If * called from other contexts @timer must neither be enqueued nor * running the callback and the caller needs to take care of * serialization. * * Note: This only updates the timer expiry value and does not requeue * the timer. */
u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval) { u64 orun = 1; ktime_t delta; delta = ktime_sub(now, hrtimer_get_expires(timer)); if (delta < 0) return 0; if (WARN_ON(timer->state & HRTIMER_STATE_ENQUEUED)) return 0; if (interval < hrtimer_resolution) interval = hrtimer_resolution; if (unlikely(delta >= interval)) { s64 incr = ktime_to_ns(interval); orun = ktime_divns(delta, incr); hrtimer_add_expires_ns(timer, incr * orun); if (hrtimer_get_expires_tv64(timer) > now) return orun; /* * This (and the ktime_add() below) is the * correction for exact: */ orun++; } hrtimer_add_expires(timer, interval); return orun; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner11083.33%240.00%
Peter Zijlstra129.09%120.00%
Arjan van de Ven86.06%120.00%
Davide Libenzi21.52%120.00%
Total132100.00%5100.00%

EXPORT_SYMBOL_GPL(hrtimer_forward); /* * enqueue_hrtimer - internal function to (re)start a timer * * The timer is inserted in expiry order. Insertion into the * red black tree is O(log(n)). Must hold the base lock. * * Returns 1 when the new timer is the leftmost timer in the tree. */
static int enqueue_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, enum hrtimer_mode mode) { debug_activate(timer, mode); base->cpu_base->active_bases |= 1 << base->index; timer->state = HRTIMER_STATE_ENQUEUED; return timerqueue_add(&base->active, &timer->node); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner4474.58%444.44%
Anna-Maria Gleixner610.17%111.11%
John Stultz46.78%111.11%
Peter Zijlstra46.78%222.22%
Xiao Guangrong11.69%111.11%
Total59100.00%9100.00%

/* * __remove_hrtimer - internal function to remove a timer * * Caller must hold the base lock. * * High resolution timer mode reprograms the clock event device when the * timer is the one which expires next. The caller can disable this by setting * reprogram to zero. This is useful, when the context does a reprogramming * anyway (e.g. timer interrupt) */
static void __remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, u8 newstate, int reprogram) { struct hrtimer_cpu_base *cpu_base = base->cpu_base; u8 state = timer->state; timer->state = newstate; if (!(state & HRTIMER_STATE_ENQUEUED)) return; if (!timerqueue_del(&base->active, &timer->node)) cpu_base->active_bases &= ~(1 << base->index); /* * Note: If reprogram is false we do not update * cpu_base->next_timer. This happens when we remove the first * timer on a remote cpu. No harm as we never dereference * cpu_base->next_timer. So the worst thing what can happen is * an superflous call to hrtimer_force_reprogram() on the * remote cpu later on if the same timer gets enqueued again. */ if (reprogram && timer == cpu_base->next_timer) hrtimer_force_reprogram(cpu_base, 1); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner6362.38%550.00%
Viresh Kumar1312.87%110.00%
Ashwin Chaugule109.90%110.00%
Jeffrey Ohlstein98.91%110.00%
Peter Zijlstra32.97%110.00%
John Stultz32.97%110.00%
Total101100.00%10100.00%

/* * remove hrtimer, called with base lock held */
static inline int remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, bool restart) { if (hrtimer_is_queued(timer)) { u8 state = timer->state; int reprogram; /* * Remove the timer and force reprogramming when high * resolution mode is active and the timer is on the current * CPU. If we remove a timer on another CPU, reprogramming is * skipped. The interrupt event on this CPU is fired and * reprogramming happens in the interrupt handler. This is a * rare case and less expensive than a smp call. */ debug_deactivate(timer); reprogram = base->cpu_base == this_cpu_ptr(&hrtimer_bases); if (!restart) state = HRTIMER_STATE_INACTIVE; __remove_hrtimer(timer, base, state, reprogram); return 1; } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner6173.49%444.44%
Peter Zijlstra1315.66%222.22%
Salman Qazi67.23%111.11%
Christoph Lameter22.41%111.11%
Xiao Guangrong11.20%111.11%
Total83100.00%9100.00%


static inline ktime_t hrtimer_update_lowres(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode) { #ifdef CONFIG_TIME_LOW_RES /* * CONFIG_TIME_LOW_RES indicates that the system has no way to return * granular time values. For relative timers we add hrtimer_resolution * (i.e. one jiffie) to prevent short timeouts. */ timer->is_rel = mode & HRTIMER_MODE_REL; if (timer->is_rel) tim = ktime_add_safe(tim, hrtimer_resolution); #endif return tim; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner52100.00%1100.00%
Total52100.00%1100.00%


static void hrtimer_update_softirq_timer(struct hrtimer_cpu_base *cpu_base, bool reprogram) { ktime_t expires; /* * Find the next SOFT expiration. */ expires = __hrtimer_get_next_event(cpu_base, HRTIMER_ACTIVE_SOFT); /* * reprogramming needs to be triggered, even if the next soft * hrtimer expires at the same time than the next hard * hrtimer. cpu_base->softirq_expires_next needs to be updated! */ if (expires == KTIME_MAX) return; /* * cpu_base->*next_timer is recomputed by __hrtimer_get_next_event() * cpu_base->*expires_next is only set by hrtimer_reprogram() */ hrtimer_reprogram(cpu_base->softirq_next_timer, reprogram); }

Contributors

PersonTokensPropCommitsCommitProp
Anna-Maria Gleixner45100.00%1100.00%
Total45100.00%1100.00%


static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, u64 delta_ns, const enum hrtimer_mode mode, struct hrtimer_clock_base *base) { struct hrtimer_clock_base *new_base; /* Remove an active timer from the queue: */ remove_hrtimer(timer, base, true); if (mode & HRTIMER_MODE_REL) tim = ktime_add_safe(tim, base->get_time()); tim = hrtimer_update_lowres(timer, tim, mode); hrtimer_set_expires_range_ns(timer, tim, delta_ns); /* Switch the timer base, if necessary: */ new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED); return enqueue_hrtimer(timer, new_base, mode); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner6259.62%741.18%
Viresh Kumar1514.42%15.88%
Anna-Maria Gleixner1312.50%211.76%
Arjan van de Ven87.69%211.76%
Peter Zijlstra32.88%211.76%
David Woodhouse10.96%15.88%
John Stultz10.96%15.88%
Arun R Bharadwaj10.96%15.88%
Total104100.00%17100.00%

/** * hrtimer_start_range_ns - (re)start an hrtimer * @timer: the timer to be added * @tim: expiry time * @delta_ns: "slack" range for the timer * @mode: timer mode: absolute (HRTIMER_MODE_ABS) or * relative (HRTIMER_MODE_REL), and pinned (HRTIMER_MODE_PINNED); * softirq based mode is considered for debug purpose only! */
void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, u64 delta_ns, const enum hrtimer_mode mode) { struct hrtimer_clock_base *base; unsigned long flags; /* * Check whether the HRTIMER_MODE_SOFT bit and hrtimer.is_soft * match. */ WARN_ON_ONCE(!(mode & HRTIMER_MODE_SOFT) ^ !timer->is_soft); base = lock_hrtimer_base(timer, &flags); if (__hrtimer_start_range_ns(timer, tim, delta_ns, mode, base)) hrtimer_reprogram(timer, true); unlock_hrtimer_base(timer, &flags); }

Contributors

PersonTokensPropCommitsCommitProp
Anna-Maria Gleixner6879.07%222.22%
Thomas Gleixner78.14%111.11%
Peter Zijlstra55.81%222.22%
Leonid Shatz33.49%111.11%
Viresh Kumar22.33%222.22%
Roman Zippel11.16%111.11%
Total86100.00%9100.00%

EXPORT_SYMBOL_GPL(hrtimer_start_range_ns); /** * hrtimer_try_to_cancel - try to deactivate a timer * @timer: hrtimer to stop * * Returns: * 0 when the timer was not active * 1 when the timer was active * -1 when the timer is currently executing the callback function and * cannot be stopped */
int hrtimer_try_to_cancel(struct hrtimer *timer) { struct hrtimer_clock_base *base; unsigned long flags; int ret = -1; /* * Check lockless first. If the timer is not active (neither * enqueued nor running the callback, nothing to do here. The * base lock does not serialize against a concurrent enqueue, * so we can avoid taking it. */ if (!hrtimer_active(timer)) return 0; base = lock_hrtimer_base(timer, &flags); if (!hrtimer_callback_running(timer)) ret = remove_hrtimer(timer, base, false); unlock_hrtimer_base(timer, &flags); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner7597.40%583.33%
Peter Zijlstra22.60%116.67%
Total77100.00%6100.00%

EXPORT_SYMBOL_GPL(hrtimer_try_to_cancel); /** * hrtimer_cancel - cancel a timer and wait for the handler to finish. * @timer: the timer to be cancelled * * Returns: * 0 when the timer was not active * 1 when the timer was active */
int hrtimer_cancel(struct hrtimer *timer) { for (;;) { int ret = hrtimer_try_to_cancel(timer); if (ret >= 0) return ret; cpu_relax(); } }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner37100.00%2100.00%
Total37100.00%2100.00%

EXPORT_SYMBOL_GPL(hrtimer_cancel); /** * hrtimer_get_remaining - get remaining time for the timer * @timer: the timer to read * @adjust: adjust relative timers when CONFIG_TIME_LOW_RES=y */
ktime_t __hrtimer_get_remaining(const struct hrtimer *timer, bool adjust) { unsigned long flags; ktime_t rem; lock_hrtimer_base(timer, &flags); if (IS_ENABLED(CONFIG_TIME_LOW_RES) && adjust) rem = hrtimer_expires_remaining_adjusted(timer); else rem = hrtimer_expires_remaining(timer); unlock_hrtimer_base(timer, &flags); return rem; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner6398.44%375.00%
Arjan van de Ven11.56%125.00%
Total64100.00%4100.00%

EXPORT_SYMBOL_GPL(__hrtimer_get_remaining); #ifdef CONFIG_NO_HZ_COMMON /** * hrtimer_get_next_event - get the time until next expiry event * * Returns the next expiry time or KTIME_MAX if no timer is pending. */
u64 hrtimer_get_next_event(void) { struct hrtimer_cpu_base *cpu_base = this_cpu_ptr(&hrtimer_bases); u64 expires = KTIME_MAX; unsigned long flags; raw_spin_lock_irqsave(&cpu_base->lock, flags); if (!__hrtimer_hres_active(cpu_base)) expires = __hrtimer_get_next_event(cpu_base, HRTIMER_ACTIVE_ALL); raw_spin_unlock_irqrestore(&cpu_base->lock, flags); return expires; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner6191.04%763.64%
Arjan van de Ven22.99%19.09%
Anna-Maria Gleixner22.99%218.18%
Christoph Lameter22.99%19.09%
Total67100.00%11100.00%

#endif
static inline int hrtimer_clockid_to_base(clockid_t clock_id) { if (likely(clock_id < MAX_CLOCKS)) { int base = hrtimer_clock_to_base_table[clock_id]; if (likely(base != HRTIMER_MAX_CLOCK_BASES)) return base; } WARN(1, "Invalid clockid %d. Using MONOTONIC\n", clock_id); return HRTIMER_BASE_MONOTONIC; }

Contributors

PersonTokensPropCommitsCommitProp
Marc Zyngier53100.00%1100.00%
Total53100.00%1100.00%


static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, enum hrtimer_mode mode) { bool softtimer = !!(mode & HRTIMER_MODE_SOFT); int base = softtimer ? HRTIMER_MAX_CLOCK_BASES / 2 : 0; struct hrtimer_cpu_base *cpu_base; memset(timer, 0, sizeof(struct hrtimer)); cpu_base = raw_cpu_ptr(&hrtimer_bases); /* * POSIX magic: Relative CLOCK_REALTIME timers are not affected by * clock modifications, so they needs to become CLOCK_MONOTONIC to * ensure POSIX compliance. */ if (clock_id == CLOCK_REALTIME && mode & HRTIMER_MODE_REL) clock_id = CLOCK_MONOTONIC; base += hrtimer_clockid_to_base(clock_id); timer->is_soft = softtimer; timer->base = &cpu_base->clock_base[base]; timerqueue_init(&timer->node); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner6557.02%337.50%
Anna-Maria Gleixner3228.07%225.00%
John Stultz1513.16%225.00%
Christoph Lameter21.75%112.50%
Total114100.00%8100.00%

/** * hrtimer_init - initialize a timer to the given clock * @timer: the timer to be initialized * @clock_id: the clock to be used * @mode: The modes which are relevant for intitialization: * HRTIMER_MODE_ABS, HRTIMER_MODE_REL, HRTIMER_MODE_ABS_SOFT, * HRTIMER_MODE_REL_SOFT * * The PINNED variants of the above can be handed in, * but the PINNED bit is ignored as pinning happens * when the hrtimer is started */
void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, enum hrtimer_mode mode) { debug_init(timer, clock_id, mode); __hrtimer_init(timer, clock_id, mode); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner3085.71%150.00%
Xiao Guangrong514.29%150.00%
Total35100.00%2100.00%

EXPORT_SYMBOL_GPL(hrtimer_init); /* * A timer is active, when it is enqueued into the rbtree or the * callback function is running or it's in the state of being migrated * to another cpu. * * It is important for this function to not return a false negative. */
bool hrtimer_active(const struct hrtimer *timer) { struct hrtimer_clock_base *base; unsigned int seq; do { base = READ_ONCE(timer->base); seq = raw_read_seqcount_begin(&base->seq); if (timer->state != HRTIMER_STATE_INACTIVE || base->running == timer) return true; } while (read_seqcount_retry(&base->seq, seq) || base != READ_ONCE(timer->base)); return false; }

Contributors

PersonTokensPropCommitsCommitProp
Peter Zijlstra5464.29%120.00%
Thomas Gleixner2125.00%240.00%
Anna-Maria Gleixner78.33%120.00%
John Stultz22.38%120.00%
Total84100.00%5100.00%

EXPORT_SYMBOL_GPL(hrtimer_active); /* * The write_seqcount_barrier()s in __run_hrtimer() split the thing into 3 * distinct sections: * * - queued: the timer is queued * - callback: the timer is being ran * - post: the timer is inactive or (re)queued * * On the read side we ensure we observe timer->state and cpu_base->running * from the same section, if anything changed while we looked at it, we retry. * This includes timer->base changing because sequence numbers alone are * insufficient for that. * * The sequence numbers are required because otherwise we could still observe * a false negative if the read side got smeared over multiple consequtive * __run_hrtimer() invocations. */
static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base, struct hrtimer_clock_base *base, struct hrtimer *timer, ktime_t *now, unsigned long flags) { enum hrtimer_restart (*fn)(struct hrtimer *); int restart; lockdep_assert_held(&cpu_base->lock); debug_deactivate(timer); base->running = timer; /* * Separate the ->running assignment from the ->state assignment. * * As with a regular write barrier, this ensures the read side in * hrtimer_active() cannot observe base->running == NULL && * timer->state == INACTIVE. */ raw_write_seqcount_barrier(&base->seq); __remove_hrtimer(timer, base, HRTIMER_STATE_INACTIVE, 0); fn = timer->function; /* * Clear the 'is relative' flag for the TIME_LOW_RES case. If the * timer is restarted with a period then it becomes an absolute * timer. If its not restarted it does not matter. */ if (IS_ENABLED(CONFIG_TIME_LOW_RES)) timer->is_rel = false; /* * The timer is marked as running in the CPU base, so it is * protected against migration to a different CPU even if the lock * is dropped. */ raw_spin_unlock_irqrestore(&cpu_base->lock, flags); trace_hrtimer_expire_entry(timer, now); restart = fn(timer); trace_hrtimer_expire_exit(timer); raw_spin_lock_irq(&cpu_base->lock); /* * Note: We clear the running state after enqueue_hrtimer and * we do not reprogram the event hardware. Happens either in * hrtimer_start_range_ns() or in hrtimer_interrupt() * * Note: Because we dropped the cpu_base->lock above, * hrtimer_start_range_ns() can have popped in and enqueued the timer * for us already. */ if (restart != HRTIMER_NORESTART && !(timer->state & HRTIMER_STATE_ENQUEUED)) enqueue_hrtimer(timer, base, HRTIMER_MODE_ABS); /* * Separate the ->running assignment from the ->state assignment. * * As with a regular write barrier, this ensures the read side in * hrtimer_active() cannot observe base->running.timer == NULL && * timer->state == INACTIVE. */ raw_write_seqcount_barrier(&base->seq); WARN_ON_ONCE(base->running != timer); base->running = NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Peter Zijlstra7941.58%526.32%
Thomas Gleixner6031.58%631.58%
Anna-Maria Gleixner178.95%315.79%
Xiao Guangrong178.95%15.26%
Tony Lindgren84.21%15.26%
Salman Qazi63.16%15.26%
Gautham R. Shenoy21.05%15.26%
Pratyush Patel10.53%15.26%
Total190100.00%19100.00%


static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now, unsigned long flags, unsigned int active_mask) { struct hrtimer_clock_base *base; unsigned int active = cpu_base->active_bases & active_mask; for_each_active_base(base, cpu_base, active) { struct timerqueue_node *node; ktime_t basenow; basenow = ktime_add(now, base->offset); while ((node = timerqueue_getnext(&base->active))) { struct hrtimer *timer; timer = container_of(node, struct hrtimer, node); /* * The immediate goal for using the softexpires is * minimizing wakeups, not running timers at the * earliest interrupt after their soft expiration. * This allows us to avoid using a Priority Search * Tree, which can answer a stabbing querry for * overlapping intervals and instead use the simple * BST we already have. * We don't add extra wakeups by delaying timers that * are right-of a not yet expired timer, because that * timer will have to trigger a wakeup anyway. */ if (basenow < hrtimer_get_softexpires_tv64(timer)) break; __run_hrtimer(cpu_base, base, timer, &basenow, flags); } } }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner4939.52%531.25%
Peter Zijlstra3225.81%16.25%
Anna-Maria Gleixner2016.13%318.75%
John Stultz64.84%16.25%
Salman Qazi54.03%16.25%
Arjan van de Ven43.23%212.50%
George Anzinger43.23%16.25%
Xiao Guangrong32.42%16.25%
Frédéric Weisbecker10.81%16.25%
Total124100.00%16100.00%


static __latent_entropy void hrtimer_run_softirq(struct softirq_action *h) { struct hrtimer_cpu_base *cpu_base = this_cpu_ptr(&hrtimer_bases); unsigned long flags; ktime_t now; raw_spin_lock_irqsave(&cpu_base->lock, flags); now = hrtimer_update_base(cpu_base); __hrtimer_run_queues(cpu_base, now, flags, HRTIMER_ACTIVE_SOFT); cpu_base->softirq_activated = 0; hrtimer_update_softirq_timer(cpu_base, true); raw_spin_unlock_irqrestore(&cpu_base->lock, flags); }

Contributors

PersonTokensPropCommitsCommitProp
Anna-Maria Gleixner81100.00%1100.00%
Total81100.00%1100.00%

#ifdef CONFIG_HIGH_RES_TIMERS /* * High resolution timer interrupt * Called with interrupts disabled */
void hrtimer_interrupt(struct clock_event_device *dev) { struct hrtimer_cpu_base *cpu_base = this_cpu_ptr(&hrtimer_bases); ktime_t expires_next, now, entry_time, delta; unsigned long flags; int retries = 0; BUG_ON(!cpu_base->hres_active); cpu_base->nr_events++; dev->next_event = KTIME_MAX; raw_spin_lock_irqsave(&cpu_base->lock, flags); entry_time = now = hrtimer_update_base(cpu_base); retry: cpu_base->in_hrtirq = 1; /* * We set expires_next to KTIME_MAX here with cpu_base->lock * held to prevent that a timer is enqueued in our queue via * the migration code. This does not affect enqueueing of * timers which run their callback and need to be requeued on * this CPU. */ cpu_base->expires_next = KTIME_MAX; if (!ktime_before(now, cpu_base->softirq_expires_next)) { cpu_base->softirq_expires_next = KTIME_MAX; cpu_base->softirq_activated = 1; raise_softirq_irqoff(HRTIMER_SOFTIRQ); } __hrtimer_run_queues(cpu_base, now, flags, HRTIMER_ACTIVE_HARD); /* Reevaluate the clock bases for the next expiry */ expires_next = __hrtimer_get_next_event(cpu_base, HRTIMER_ACTIVE_ALL); /* * Store the new expiry value so the migration code can verify * against it. */ cpu_base->expires_next = expires_next; cpu_base->in_hrtirq = 0; raw_spin_unlock_irqrestore(&cpu_base->lock, flags); /* Reprogramming necessary ? */ if (!tick_program_event(expires_next, 0)) { cpu_base->hang_detected = 0; return; } /* * The next timer was already expired due to: * - tracing * - long lasting callbacks * - being scheduled away when running in a VM * * We need to prevent that we loop forever in the hrtimer * interrupt routine. We give it 3 attempts to avoid * overreacting on some spurious event. * * Acquire base lock for updating the offsets and retrieving * the current time. */ raw_spin_lock_irqsave(&cpu_base->lock, flags); now = hrtimer_update_base(cpu_base); cpu_base->nr_retries++; if (++retries < 3) goto retry; /* * Give the system a chance to do something else than looping * here. We stored the entry time, so we know exactly how long * we spent here. We schedule the next event this amount of * time away. */ cpu_base->nr_hangs++; cpu_base->hang_detected = 1; raw_spin_unlock_irqrestore(&cpu_base->lock, flags); delta = ktime_sub(now, entry_time); if ((unsigned int)delta > cpu_base->max_hang_time) cpu_base->max_hang_time = (unsigned int) delta; /* * Limit it to a sensible value as we enforce a longer * delay. Give the CPU at least 100ms to catch up. */ if (delta > 100 * NSEC_PER_MSEC) expires_next = ktime_add_ns(now, 100 * NSEC_PER_MSEC); else expires_next = ktime_add(now, delta); tick_program_event(expires_next, 1); printk_once(KERN_WARNING "hrtimer: interrupt took %llu ns\n", ktime_to_ns(delta)); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner21065.42%844.44%
Anna-Maria Gleixner5316.51%316.67%
Peter Zijlstra3912.15%15.56%
John Stultz92.80%15.56%
Frédéric Weisbecker30.93%15.56%
Christoph Lameter20.62%15.56%
George Anzinger20.62%15.56%
Stephen Hemminger20.62%15.56%
Xiao Guangrong10.31%15.56%
Total321100.00%18100.00%

/* called with interrupts disabled */
static inline void __hrtimer_peek_ahead_timers(void) { struct tick_device *td; if (!hrtimer_hres_active()) return; td = this_cpu_ptr(&tick_cpu_device); if (td && td->evtdev) hrtimer_interrupt(td->evtdev); }

Contributors

PersonTokensPropCommitsCommitProp
Arjan van de Ven3477.27%233.33%
Thomas Gleixner818.18%350.00%
Christoph Lameter24.55%116.67%
Total44100.00%6100.00%

#else /* CONFIG_HIGH_RES_TIMERS */
static inline void __hrtimer_peek_ahead_timers(void) { }

Contributors

PersonTokensPropCommitsCommitProp
Ingo Molnar8100.00%1100.00%
Total8100.00%1100.00%

#endif /* !CONFIG_HIGH_RES_TIMERS */ /* * Called from run_local_timers in hardirq context every jiffy */
void hrtimer_run_queues(void) { struct hrtimer_cpu_base *cpu_base = this_cpu_ptr(&hrtimer_bases); unsigned long flags; ktime_t now; if (__hrtimer_hres_active(cpu_base)) return; /* * This _is_ ugly: We have to check periodically, whether we * can switch to highres and / or nohz mode. The clocksource * switch happens with xtime_lock held. Notification from * there only sets the check bit in the tick_oneshot code, * otherwise we might deadlock vs. xtime_lock. */ if (tick_check_oneshot_change(!hrtimer_is_hres_enabled())) { hrtimer_switch_to_hres(); return; } raw_spin_lock_irqsave(&cpu_base->lock, flags); now = hrtimer_update_base(cpu_base); if (!ktime_before(now, cpu_base->softirq_expires_next)) { cpu_base->softirq_expires_next = KTIME_MAX; cpu_base->softirq_activated = 1; raise_softirq_irqoff(HRTIMER_SOFTIRQ); } __hrtimer_run_queues(cpu_base, now, flags, HRTIMER_ACTIVE_HARD); raw_spin_unlock_irqrestore(&cpu_base->lock, flags); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner5143.22%847.06%
Anna-Maria Gleixner4538.14%317.65%
Dimitri Sivanich1613.56%211.76%
John Stultz21.69%15.88%
Christoph Lameter21.69%15.88%
Peter Zijlstra10.85%15.88%
Xiao Guangrong10.85%15.88%
Total118100.00%17100.00%

/* * Sleep related functions: */
static enum hrtimer_restart hrtimer_wakeup(struct hrtimer *timer) { struct hrtimer_sleeper *t = container_of(timer, struct hrtimer_sleeper, timer); struct task_struct *task = t->task; t->task = NULL; if (task) wake_up_process(task); return HRTIMER_NORESTART; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner54100.00%2100.00%
Total54100.00%2100.00%


void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, struct task_struct *task) { sl->timer.function = hrtimer_wakeup; sl->task = task; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner2793.10%150.00%
Ingo Molnar26.90%150.00%
Total29100.00%2100.00%

EXPORT_SYMBOL_GPL(hrtimer_init_sleeper);
int nanosleep_copyout(struct restart_block *restart, struct timespec64 *ts) { switch(restart->nanosleep.type) { #ifdef CONFIG_COMPAT case TT_COMPAT: if (compat_put_timespec64(ts, restart->nanosleep.compat_rmtp)) return -EFAULT; break; #endif case TT_NATIVE: if (put_timespec64(ts, restart->nanosleep.rmtp)) return -EFAULT; break; default: BUG(); } return -ERESTART_RESTARTBLOCK; }

Contributors

PersonTokensPropCommitsCommitProp
Al Viro7593.75%150.00%
Deepa Dinamani56.25%150.00%
Total80100.00%2100.00%


static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mode) { struct restart_block *restart; hrtimer_init_sleeper(t, current); do { set_current_state(TASK_INTERRUPTIBLE); hrtimer_start_expires(&t->timer, mode); if (likely(t->task)) freezable_schedule(); hrtimer_cancel(&t->timer); mode = HRTIMER_MODE_ABS; } while (t->task && !signal_pending(current)); __set_current_state(TASK_RUNNING); if (!t->task) return 0; restart = &current->restart_block; if (restart->nanosleep.type != TT_NONE) { ktime_t rem = hrtimer_expires_remaining(&t->timer); struct timespec64 rmt; if (rem <= 0) return 0; rmt = ktime_to_timespec64(rem); return nanosleep_copyout(restart, &rmt); } return -ERESTART_RESTARTBLOCK; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner4527.95%430.77%
Al Viro4226.09%323.08%
Roman Zippel3421.12%17.69%
Oleg Nesterov3018.63%17.69%
Peter Zijlstra53.11%17.69%
Arjan van de Ven21.24%17.69%
Deepa Dinamani21.24%17.69%
Colin Cross10.62%17.69%
Total161100.00%13100.00%


static long __sched hrtimer_nanosleep_restart(struct restart_block *restart) { struct hrtimer_sleeper t; int ret; hrtimer_init_on_stack(&t.timer, restart->nanosleep.clockid, HRTIMER_MODE_ABS); hrtimer_set_expires_tv64(&t.timer, restart->nanosleep.expires); ret = do_nanosleep(&t, HRTIMER_MODE_ABS); destroy_hrtimer_on_stack(&t.timer); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner4665.71%646.15%
Roman Zippel1014.29%17.69%
Arjan van de Ven57.14%17.69%
Al Viro34.29%215.38%
George Anzinger34.29%17.69%
Oleg Nesterov22.86%17.69%
Toyo Abe11.43%17.69%
Total70100.00%13100.00%


long hrtimer_nanosleep(const struct timespec64 *rqtp, const enum hrtimer_mode mode, const clockid_t clockid) { struct restart_block *restart; struct hrtimer_sleeper t; int ret = 0; u64 slack; slack = current->timer_slack_ns; if (dl_task(current) || rt_task(current)) slack = 0; hrtimer_init_on_stack(&t.timer, clockid, mode); hrtimer_set_expires_range_ns(&t.timer, timespec64_to_ktime(*rqtp), slack); ret = do_nanosleep(&t, mode); if (ret != -ERESTART_RESTARTBLOCK) goto out; /* Absolute timers do not update the rmtp value and restart: */ if (mode == HRTIMER_MODE_ABS) { ret = -ERESTARTNOHAND; goto out; } restart = &current->restart_block; restart->fn = hrtimer_nanosleep_restart; restart->nanosleep.clockid = t.timer.base->clockid; restart->nanosleep.expires = hrtimer_get_expires_tv64(&t.timer); out: destroy_hrtimer_on_stack(&t.timer); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner10659.55%738.89%
Arjan van de Ven3016.85%211.11%
Al Viro137.30%211.11%
Roman Zippel116.18%15.56%
George Anzinger63.37%15.56%
Dario Faggioli52.81%15.56%
Toyo Abe31.69%15.56%
Deepa Dinamani21.12%15.56%
Oleg Nesterov10.56%15.56%
John Stultz10.56%15.56%
Total178100.00%18100.00%

SYSCALL_DEFINE2(nanosleep, struct timespec __user *, rqtp, struct timespec __user *, rmtp) { struct timespec64 tu; if (get_timespec64(&tu, rqtp)) return -EFAULT; if (!timespec64_valid(&tu)) return -EINVAL; current->restart_block.nanosleep.type = rmtp ? TT_NATIVE : TT_NONE; current->restart_block.nanosleep.rmtp = rmtp; return hrtimer_nanosleep(&tu, HRTIMER_MODE_REL, CLOCK_MONOTONIC); } #ifdef CONFIG_COMPAT COMPAT_SYSCALL_DEFINE2(nanosleep, struct compat_timespec __user *, rqtp, struct compat_timespec __user *, rmtp) { struct timespec64 tu; if (compat_get_timespec64(&tu, rqtp)) return -EFAULT; if (!timespec64_valid(&tu)) return -EINVAL; current->restart_block.nanosleep.type = rmtp ? TT_COMPAT : TT_NONE; current->restart_block.nanosleep.compat_rmtp = rmtp; return hrtimer_nanosleep(&tu, HRTIMER_MODE_REL, CLOCK_MONOTONIC); } #endif /* * Functions related to boot-time initialization: */
int hrtimers_prepare_cpu(unsigned int cpu) { struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu); int i; for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) { cpu_base->clock_base[i].cpu_base = cpu_base; timerqueue_init_head(&cpu_base->clock_base[i].active); } cpu_base->cpu = cpu; cpu_base->active_bases = 0; cpu_base->hres_active = 0; cpu_base->hang_detected = 0; cpu_base->next_timer = NULL; cpu_base->softirq_next_timer = NULL; cpu_base->expires_next = KTIME_MAX; cpu_base->softirq_expires_next = KTIME_MAX; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner7867.83%654.55%
Anna-Maria Gleixner1613.91%327.27%
John Stultz1513.04%19.09%
Viresh Kumar65.22%19.09%
Total115100.00%11100.00%

#ifdef CONFIG_HOTPLUG_CPU
static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base, struct hrtimer_clock_base *new_base) { struct hrtimer *timer; struct timerqueue_node *node; while ((node = timerqueue_getnext(&old_base->active))) { timer = container_of(node, struct hrtimer, node); BUG_ON(hrtimer_callback_running(timer)); debug_deactivate(timer); /* * Mark it as ENQUEUED not INACTIVE otherwise the * timer could be seen as !active and just vanish away * under us on another CPU */ __remove_hrtimer(timer, old_base, HRTIMER_STATE_ENQUEUED, 0); timer->base = new_base; /* * Enqueue the timers on the new cpu. This does not * reprogram the event device in case the timer * expires before the earliest on this CPU, but we run * hrtimer_interrupt after we migrated everything to * sort out already expired timers and reprogram the * event device. */ enqueue_hrtimer(timer, new_base, HRTIMER_MODE_ABS); } }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner8690.53%861.54%
John Stultz33.16%17.69%
Anna-Maria Gleixner22.11%17.69%
Oleg Nesterov22.11%17.69%
Xiao Guangrong11.05%17.69%
Peter Zijlstra11.05%17.69%
Total95100.00%13100.00%


int hrtimers_dead_cpu(unsigned int scpu) { struct hrtimer_cpu_base *old_base, *new_base; int i; BUG_ON(cpu_online(scpu)); tick_cancel_sched_timer(scpu); /* * this BH disable ensures that raise_softirq_irqoff() does * not wakeup ksoftirqd (and acquire the pi-lock) while * holding the cpu_base lock */ local_bh_disable(); local_irq_disable(); old_base = &per_cpu(hrtimer_bases, scpu); new_base = this_cpu_ptr(&hrtimer_bases); /* * The caller is globally serialized and nobody else * takes two locks at once, deadlock is not possible. */ raw_spin_lock(&new_base->lock); raw_spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING); for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) { migrate_hrtimer_list(&old_base->clock_base[i], &new_base->clock_base[i]); } /* * The migration might have changed the first expiring softirq * timer on this CPU. Update it. */ hrtimer_update_softirq_timer(new_base, false); raw_spin_unlock(&old_base->lock); raw_spin_unlock(&new_base->lock); /* Check, if we got expired work to do */ __hrtimer_peek_ahead_timers(); local_irq_enable(); local_bh_enable(); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner11678.38%545.45%
Anna-Maria Gleixner1510.14%19.09%
Oleg Nesterov106.76%218.18%
Peter Zijlstra42.70%19.09%
Christoph Lameter21.35%19.09%
Heiko Carstens10.68%19.09%
Total148100.00%11100.00%

#endif /* CONFIG_HOTPLUG_CPU */
void __init hrtimers_init(void) { hrtimers_prepare_cpu(smp_processor_id()); open_softirq(HRTIMER_SOFTIRQ, hrtimer_run_softirq); }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner1466.67%266.67%
Anna-Maria Gleixner733.33%133.33%
Total21100.00%3100.00%

/** * schedule_hrtimeout_range_clock - sleep until timeout * @expires: timeout value (ktime_t) * @delta: slack in expires timeout (ktime_t) * @mode: timer mode * @clock_id: timer clock to be used */
int __sched schedule_hrtimeout_range_clock(ktime_t *expires, u64 delta, const enum hrtimer_mode mode, clockid_t clock_id) { struct hrtimer_sleeper t; /* * Optimize when a zero timeout value is given. It does not * matter whether this is an absolute or a relative time. */ if (expires && *expires == 0) { __set_current_state(TASK_RUNNING); return 0; } /* * A NULL parameter means "infinite" */ if (!expires) { schedule(); return -EINTR; } hrtimer_init_on_stack(&t.timer, clock_id, mode); hrtimer_set_expires_range_ns(&t.timer, *expires, delta); hrtimer_init_sleeper(&t, current); hrtimer_start_expires(&t.timer, mode); if (likely(t.task)) schedule(); hrtimer_cancel(&t.timer); destroy_hrtimer_on_stack(&t.timer); __set_current_state(TASK_RUNNING); return !t.task ? 0 : -EINTR; }

Contributors

PersonTokensPropCommitsCommitProp
Arjan van de Ven13793.20%337.50%
Anna-Maria Gleixner32.04%112.50%
Thomas Gleixner32.04%112.50%
Carsten Emde21.36%112.50%
Namhyung Kim10.68%112.50%
John Stultz10.68%112.50%
Total147100.00%8100.00%

/** * schedule_hrtimeout_range - sleep until timeout * @expires: timeout value (ktime_t) * @delta: slack in expires timeout (ktime_t) * @mode: timer mode * * Make the current task sleep until the given expiry time has * elapsed. The routine will return immediately unless * the current task state has been set (see set_current_state()). * * The @delta argument gives the kernel the freedom to schedule the * actual wakeup to a time that is both power and performance friendly. * The kernel give the normal best effort behavior for "@expires+@delta", * but may decide to fire the timer earlier, but no earlier than @expires. * * You can set the task state as follows - * * %TASK_UNINTERRUPTIBLE - at least @timeout time is guaranteed to * pass before the routine returns unless the current task is explicitly * woken up, (e.g. by wake_up_process()). * * %TASK_INTERRUPTIBLE - the routine may return early if a signal is * delivered to the current task or the current task is explicitly woken * up. * * The current task state is guaranteed to be TASK_RUNNING when this * routine returns. * * Returns 0 when the timer has expired. If the task was woken before the * timer expired by a signal (only possible in state TASK_INTERRUPTIBLE) or * by an explicit wakeup, it returns -EINTR. */
int __sched schedule_hrtimeout_range(ktime_t *expires, u64 delta, const enum hrtimer_mode mode) { return schedule_hrtimeout_range_clock(expires, delta, mode, CLOCK_MONOTONIC); }

Contributors

PersonTokensPropCommitsCommitProp
Carsten Emde2996.67%150.00%
John Stultz13.33%150.00%
Total30100.00%2100.00%

EXPORT_SYMBOL_GPL(schedule_hrtimeout_range); /** * schedule_hrtimeout - sleep until timeout * @expires: timeout value (ktime_t) * @mode: timer mode * * Make the current task sleep until the given expiry time has * elapsed. The routine will return immediately unless * the current task state has been set (see set_current_state()). * * You can set the task state as follows - * * %TASK_UNINTERRUPTIBLE - at least @timeout time is guaranteed to * pass before the routine returns unless the current task is explicitly * woken up, (e.g. by wake_up_process()). * * %TASK_INTERRUPTIBLE - the routine may return early if a signal is * delivered to the current task or the current task is explicitly woken * up. * * The current task state is guaranteed to be TASK_RUNNING when this * routine returns. * * Returns 0 when the timer has expired. If the task was woken before the * timer expired by a signal (only possible in state TASK_INTERRUPTIBLE) or * by an explicit wakeup, it returns -EINTR. */
int __sched schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode) { return schedule_hrtimeout_range(expires, 0, mode); }

Contributors

PersonTokensPropCommitsCommitProp
Arjan van de Ven25100.00%1100.00%
Total25100.00%1100.00%

EXPORT_SYMBOL_GPL(schedule_hrtimeout);

Overall Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner318752.92%5831.02%
Anna-Maria Gleixner115319.15%2211.76%
Peter Zijlstra2884.78%105.35%
Arjan van de Ven2694.47%73.74%
Al Viro2424.02%52.67%
John Stultz1572.61%84.28%
Xiao Guangrong1101.83%10.53%
Marc Zyngier641.06%10.53%
Roman Zippel570.95%31.60%
Arun R Bharadwaj490.81%21.07%
Oleg Nesterov460.76%42.14%
Viresh Kumar360.60%52.67%
Carsten Emde310.51%10.53%
Ingo Molnar300.50%63.21%
Stanislaw Gruszka280.46%10.53%
Stephen Hemminger240.40%21.07%
Leon Ma210.35%10.53%
Salman Qazi170.28%10.53%
Deepa Dinamani170.28%21.07%
Christoph Lameter160.27%21.07%
Dimitri Sivanich160.27%21.07%
George Anzinger150.25%10.53%
Frédéric Weisbecker150.25%52.67%
Heiko Carstens130.22%21.07%
Michael Bohan100.17%10.53%
Ashwin Chaugule100.17%10.53%
Jeffrey Ohlstein90.15%10.53%
Changbin Du90.15%21.07%
Kees Cook80.13%10.53%
Dario Faggioli80.13%10.53%
Tony Lindgren80.13%10.53%
Clark Williams60.10%21.07%
Guenter Roeck60.10%21.07%
Stas Sergeev50.08%10.53%
Artem B. Bityutskiy50.08%10.53%
Toyo Abe40.07%10.53%
Colin Cross40.07%10.53%
Luiz Fernando N. Capitulino30.05%10.53%
Leonid Shatz30.05%10.53%
Gautham R. Shenoy20.03%10.53%
Davide Libenzi20.03%10.53%
Jan Blunck20.03%10.53%
Russell King20.03%10.53%
Pratyush Patel20.03%10.53%
Nico Pitre20.03%10.53%
Mike Frysinger10.02%10.53%
Vegard Nossum10.02%10.53%
Zhen Lei10.02%10.53%
Stephen Boyd10.02%10.53%
Masanari Iida10.02%10.53%
David Woodhouse10.02%10.53%
Linus Torvalds10.02%10.53%
Paul Gortmaker10.02%10.53%
Namhyung Kim10.02%10.53%
Uwe Kleine-König10.02%10.53%
Fengguang Wu10.02%10.53%
Total6022100.00%187100.00%
Directory: kernel/time
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.