Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1739856
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 18/25] hrtimer: Enable soft and hard hrtimer |
| Date | 2017-09-26 15:00 +0200 |
| Message-ID | <utXCV-4V5-1@gated-at.bofh.it> (permalink) |
| References | <ukwLD-5Ay-3@gated-at.bofh.it> <ukwLE-5Ay-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Aug 31, 2017 at 12:23:42PM -0000, Anna-Maria Gleixner wrote:
> --- a/include/linux/hrtimer.h
> +++ b/include/linux/hrtimer.h
> @@ -23,6 +23,17 @@
> #include <linux/timer.h>
> #include <linux/timerqueue.h>
>
> +/*
> + * Clock ids for hrtimers which expire in softirq context. These clock ids
> + * are kernel internal and never exported to user space.
> + */
> +#define HRTIMER_BASE_SOFT_MASK MAX_CLOCKS
> +
> +#define CLOCK_REALTIME_SOFT (CLOCK_REALTIME | HRTIMER_BASE_SOFT_MASK)
> +#define CLOCK_MONOTONIC_SOFT (CLOCK_MONOTONIC | HRTIMER_BASE_SOFT_MASK)
> +#define CLOCK_BOOTTIME_SOFT (CLOCK_BOOTTIME | HRTIMER_BASE_SOFT_MASK)
> +#define CLOCK_TAI_SOFT (CLOCK_TAI | HRTIMER_BASE_SOFT_MASK)
> +
> struct hrtimer_clock_base;
> struct hrtimer_cpu_base;
>
> --- a/kernel/time/hrtimer.c
> +++ b/kernel/time/hrtimer.c
> @@ -1173,7 +1161,7 @@ u64 hrtimer_get_next_event(void)
>
> static inline int hrtimer_clockid_to_base(clockid_t clock_id)
> {
> + if (likely(clock_id < MAX_CLOCKS_HRT)) {
> int base = hrtimer_clock_to_base_table[clock_id];
>
> if (likely(base != HRTIMER_MAX_CLOCK_BASES))
> @@ -1193,8 +1181,12 @@ static void __hrtimer_init(struct hrtime
>
> cpu_base = raw_cpu_ptr(&hrtimer_bases);
>
> + if (mode != HRTIMER_MODE_ABS) {
> + if (clock_id == CLOCK_REALTIME)
> + clock_id = CLOCK_MONOTONIC;
> + else if (clock_id == CLOCK_REALTIME_SOFT)
> + clock_id = CLOCK_MONOTONIC_SOFT;
> + }
>
> base = hrtimer_clockid_to_base(clock_id);
> timer->base = &cpu_base->clock_base[base];
So why expose these extra bases at all, why not stick another flag in
MODE? These extra bases is a pure implementation detail imo; you could
equally implement the functionality without (albeit at extra cost).
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH 18/25] hrtimer: Enable soft and hard hrtimer Peter Zijlstra <peterz@infradead.org> - 2017-09-26 15:00 +0200
Re: [PATCH 18/25] hrtimer: Enable soft and hard hrtimer Anna-Maria Gleixner <anna-maria@linutronix.de> - 2017-09-27 16:20 +0200
Re: [PATCH 18/25] hrtimer: Enable soft and hard hrtimer Thomas Gleixner <tglx@linutronix.de> - 2017-09-27 18:00 +0200
Re: [PATCH 18/25] hrtimer: Enable soft and hard hrtimer Peter Zijlstra <peterz@infradead.org> - 2017-09-27 18:50 +0200
csiph-web