Skip to content

Commit 336622e

Browse files
committed
Merge tag 'timers-nohz-2020-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull NOHZ update from Thomas Gleixner: "Remove TIF_NOHZ from three architectures These architectures use a static key to decide whether context tracking needs to be invoked and the TIF_NOHZ flag just causes a pointless slowpath execution for nothing" * tag 'timers-nohz-2020-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: arm64: Remove TIF_NOHZ arm: Remove TIF_NOHZ x86: Remove TIF_NOHZ context-tracking: Introduce CONFIG_HAVE_TIF_NOHZ x86/entry: Remove _TIF_NOHZ from _TIF_WORK_SYSCALL_ENTRY
2 parents 992a1a3 + e4970c9 commit 336622e

File tree

8 files changed

+19
-17
lines changed

8 files changed

+19
-17
lines changed

arch/Kconfig

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -540,11 +540,17 @@ config HAVE_CONTEXT_TRACKING
540540
help
541541
Provide kernel/user boundaries probes necessary for subsystems
542542
that need it, such as userspace RCU extended quiescent state.
543-
Syscalls need to be wrapped inside user_exit()-user_enter() through
544-
the slow path using TIF_NOHZ flag. Exceptions handlers must be
545-
wrapped as well. Irqs are already protected inside
546-
rcu_irq_enter/rcu_irq_exit() but preemption or signal handling on
547-
irq exit still need to be protected.
543+
Syscalls need to be wrapped inside user_exit()-user_enter(), either
544+
optimized behind static key or through the slow path using TIF_NOHZ
545+
flag. Exceptions handlers must be wrapped as well. Irqs are already
546+
protected inside rcu_irq_enter/rcu_irq_exit() but preemption or signal
547+
handling on irq exit still need to be protected.
548+
549+
config HAVE_TIF_NOHZ
550+
bool
551+
help
552+
Arch relies on TIF_NOHZ and syscall slow path to implement context
553+
tracking calls to user_enter()/user_exit().
548554

549555
config HAVE_VIRT_CPU_ACCOUNTING
550556
bool

arch/arm/include/asm/thread_info.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ extern int vfp_restore_user_hwstate(struct user_vfp *,
141141
#define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */
142142
#define TIF_SECCOMP 7 /* seccomp syscall filtering active */
143143

144-
#define TIF_NOHZ 12 /* in adaptive nohz mode */
145144
#define TIF_USING_IWMMXT 17
146145
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
147146
#define TIF_RESTORE_SIGMASK 20

arch/arm64/include/asm/thread_info.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ void arch_release_task_struct(struct task_struct *tsk);
6363
#define TIF_FOREIGN_FPSTATE 3 /* CPU's FP state is not current's */
6464
#define TIF_UPROBE 4 /* uprobe breakpoint or singlestep */
6565
#define TIF_FSCHECK 5 /* Check FS is USER_DS on return */
66-
#define TIF_NOHZ 7
6766
#define TIF_SYSCALL_TRACE 8 /* syscall trace active */
6867
#define TIF_SYSCALL_AUDIT 9 /* syscall auditing */
6968
#define TIF_SYSCALL_TRACEPOINT 10 /* syscall tracepoint for ftrace */
@@ -83,7 +82,6 @@ void arch_release_task_struct(struct task_struct *tsk);
8382
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
8483
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
8584
#define _TIF_FOREIGN_FPSTATE (1 << TIF_FOREIGN_FPSTATE)
86-
#define _TIF_NOHZ (1 << TIF_NOHZ)
8785
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
8886
#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
8987
#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
@@ -100,7 +98,7 @@ void arch_release_task_struct(struct task_struct *tsk);
10098

10199
#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
102100
_TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \
103-
_TIF_NOHZ | _TIF_SYSCALL_EMU)
101+
_TIF_SYSCALL_EMU)
104102

105103
#define INIT_THREAD_INFO(tsk) \
106104
{ \

arch/mips/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ config MIPS
5151
select HAVE_ASM_MODVERSIONS
5252
select HAVE_CBPF_JIT if !64BIT && !CPU_MICROMIPS
5353
select HAVE_CONTEXT_TRACKING
54+
select HAVE_TIF_NOHZ
5455
select HAVE_COPY_THREAD_TLS
5556
select HAVE_C_RECORDMCOUNT
5657
select HAVE_DEBUG_KMEMLEAK

arch/powerpc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ config PPC
182182
select HAVE_STACKPROTECTOR if PPC64 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r13)
183183
select HAVE_STACKPROTECTOR if PPC32 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r2)
184184
select HAVE_CONTEXT_TRACKING if PPC64
185+
select HAVE_TIF_NOHZ if PPC64
185186
select HAVE_COPY_THREAD_TLS
186187
select HAVE_DEBUG_KMEMLEAK
187188
select HAVE_DEBUG_STACKOVERFLOW

arch/sparc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ config SPARC64
7171
select HAVE_FTRACE_MCOUNT_RECORD
7272
select HAVE_SYSCALL_TRACEPOINTS
7373
select HAVE_CONTEXT_TRACKING
74+
select HAVE_TIF_NOHZ
7475
select HAVE_DEBUG_KMEMLEAK
7576
select IOMMU_HELPER
7677
select SPARSE_IRQ

arch/x86/include/asm/thread_info.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ struct thread_info {
9292
#define TIF_NOCPUID 15 /* CPUID is not accessible in userland */
9393
#define TIF_NOTSC 16 /* TSC is not accessible in userland */
9494
#define TIF_IA32 17 /* IA32 compatibility process */
95-
#define TIF_NOHZ 19 /* in adaptive nohz mode */
9695
#define TIF_MEMDIE 20 /* is terminating due to OOM killer */
9796
#define TIF_POLLING_NRFLAG 21 /* idle is polling for TIF_NEED_RESCHED */
9897
#define TIF_IO_BITMAP 22 /* uses I/O bitmap */
@@ -122,7 +121,6 @@ struct thread_info {
122121
#define _TIF_NOCPUID (1 << TIF_NOCPUID)
123122
#define _TIF_NOTSC (1 << TIF_NOTSC)
124123
#define _TIF_IA32 (1 << TIF_IA32)
125-
#define _TIF_NOHZ (1 << TIF_NOHZ)
126124
#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
127125
#define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP)
128126
#define _TIF_FORCED_TF (1 << TIF_FORCED_TF)
@@ -133,14 +131,10 @@ struct thread_info {
133131
#define _TIF_X32 (1 << TIF_X32)
134132
#define _TIF_FSCHECK (1 << TIF_FSCHECK)
135133

136-
/*
137-
* work to do in syscall_trace_enter(). Also includes TIF_NOHZ for
138-
* enter_from_user_mode()
139-
*/
134+
/* Work to do before invoking the actual syscall. */
140135
#define _TIF_WORK_SYSCALL_ENTRY \
141136
(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | _TIF_SYSCALL_AUDIT | \
142-
_TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT | \
143-
_TIF_NOHZ)
137+
_TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)
144138

145139
/* flags to check in __switch_to() */
146140
#define _TIF_WORK_CTXSW_BASE \

kernel/context_tracking.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,13 @@ void __init context_tracking_cpu_set(int cpu)
198198
if (initialized)
199199
return;
200200

201+
#ifdef CONFIG_HAVE_TIF_NOHZ
201202
/*
202203
* Set TIF_NOHZ to init/0 and let it propagate to all tasks through fork
203204
* This assumes that init is the only task at this early boot stage.
204205
*/
205206
set_tsk_thread_flag(&init_task, TIF_NOHZ);
207+
#endif
206208
WARN_ON_ONCE(!tasklist_empty());
207209

208210
initialized = true;

0 commit comments

Comments
 (0)