Skip to content

Commit b019b4a

Browse files
committed
Merge tag 'timers-urgent-2024-11-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fix from Thomas Gleixner: "A single fix for posix CPU timers. When a thread is cloned, the posix CPU timers are not inherited. If the parent has a CPU timer armed the corresponding tick dependency in the tasks tick_dep_mask is set and copied to the new thread, which means the new thread and all decendants will prevent the system to go into full NOHZ operation. Clear the tick dependency mask in copy_process() to fix this" * tag 'timers-urgent-2024-11-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: posix-cpu-timers: Clear TICK_DEP_BIT_POSIX_TIMER on clone
2 parents 33e83ff + b541315 commit b019b4a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

include/linux/tick.h

+8
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,19 @@ static inline void tick_dep_set_task(struct task_struct *tsk,
251251
if (tick_nohz_full_enabled())
252252
tick_nohz_dep_set_task(tsk, bit);
253253
}
254+
254255
static inline void tick_dep_clear_task(struct task_struct *tsk,
255256
enum tick_dep_bits bit)
256257
{
257258
if (tick_nohz_full_enabled())
258259
tick_nohz_dep_clear_task(tsk, bit);
259260
}
261+
262+
static inline void tick_dep_init_task(struct task_struct *tsk)
263+
{
264+
atomic_set(&tsk->tick_dep_mask, 0);
265+
}
266+
260267
static inline void tick_dep_set_signal(struct task_struct *tsk,
261268
enum tick_dep_bits bit)
262269
{
@@ -290,6 +297,7 @@ static inline void tick_dep_set_task(struct task_struct *tsk,
290297
enum tick_dep_bits bit) { }
291298
static inline void tick_dep_clear_task(struct task_struct *tsk,
292299
enum tick_dep_bits bit) { }
300+
static inline void tick_dep_init_task(struct task_struct *tsk) { }
293301
static inline void tick_dep_set_signal(struct task_struct *tsk,
294302
enum tick_dep_bits bit) { }
295303
static inline void tick_dep_clear_signal(struct signal_struct *signal,

kernel/fork.c

+2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
#include <linux/rseq.h>
106106
#include <uapi/linux/pidfd.h>
107107
#include <linux/pidfs.h>
108+
#include <linux/tick.h>
108109

109110
#include <asm/pgalloc.h>
110111
#include <linux/uaccess.h>
@@ -2292,6 +2293,7 @@ __latent_entropy struct task_struct *copy_process(
22922293
acct_clear_integrals(p);
22932294

22942295
posix_cputimers_init(&p->posix_cputimers);
2296+
tick_dep_init_task(p);
22952297

22962298
p->io_context = NULL;
22972299
audit_set_context(p, NULL);

0 commit comments

Comments
 (0)