Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] hrtimer: round up relative start time on low-res arches

CONFIG_TIME_LOW_RES is a temporary way for architectures to signal that
they simply return xtime in do_gettimeoffset(). In this corner-case we
want to round up by resolution when starting a relative timer, to avoid
short timeouts. This will go away with the GTOD framework.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Ingo Molnar and committed by
Linus Torvalds
06027bdd e35a6619

+37 -1
+4
arch/frv/Kconfig
··· 25 25 bool 26 26 default n 27 27 28 + config TIME_LOW_RES 29 + bool 30 + default y 31 + 28 32 mainmenu "Fujitsu FR-V Kernel Configuration" 29 33 30 34 source "init/Kconfig"
+4
arch/h8300/Kconfig
··· 33 33 bool 34 34 default y 35 35 36 + config TIME_LOW_RES 37 + bool 38 + default y 39 + 36 40 config ISA 37 41 bool 38 42 default y
+4
arch/m68k/Kconfig
··· 21 21 bool 22 22 default y 23 23 24 + config TIME_LOW_RES 25 + bool 26 + default y 27 + 24 28 config ARCH_MAY_HAVE_PC_FDC 25 29 bool 26 30 depends on Q40 || (BROKEN && SUN3X)
+4
arch/m68knommu/Kconfig
··· 29 29 bool 30 30 default y 31 31 32 + config TIME_LOW_RES 33 + bool 34 + default y 35 + 32 36 source "init/Kconfig" 33 37 34 38 menu "Processor type and features"
+5
arch/parisc/Kconfig
··· 29 29 bool 30 30 default y 31 31 32 + config TIME_LOW_RES 33 + bool 34 + depends on SMP 35 + default y 36 + 32 37 config GENERIC_ISA_DMA 33 38 bool 34 39
+4
arch/v850/Kconfig
··· 28 28 bool 29 29 default y 30 30 31 + config TIME_LOW_RES 32 + bool 33 + default y 34 + 31 35 # Turn off some random 386 crap that can affect device config 32 36 config ISA 33 37 bool
+12 -1
kernel/hrtimer.c
··· 418 418 /* Switch the timer base, if necessary: */ 419 419 new_base = switch_hrtimer_base(timer, base); 420 420 421 - if (mode == HRTIMER_REL) 421 + if (mode == HRTIMER_REL) { 422 422 tim = ktime_add(tim, new_base->get_time()); 423 + /* 424 + * CONFIG_TIME_LOW_RES is a temporary way for architectures 425 + * to signal that they simply return xtime in 426 + * do_gettimeoffset(). In this case we want to round up by 427 + * resolution when starting a relative timer, to avoid short 428 + * timeouts. This will go away with the GTOD framework. 429 + */ 430 + #ifdef CONFIG_TIME_LOW_RES 431 + tim = ktime_add(tim, base->resolution); 432 + #endif 433 + } 423 434 timer->expires = tim; 424 435 425 436 enqueue_hrtimer(timer, new_base);