aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/kernel/time/posix-cpu-timers.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2021-12-17 11:33:33 +0100
committerThomas Zimmermann <tzimmermann@suse.de>2021-12-17 11:33:33 +0100
commit1758047057dbe329be712a31b79db7151b5871f8 (patch)
tree00203eb55328f2feda70b3d37c964287b364796f /kernel/time/posix-cpu-timers.c
parentdrm/locking: fix __stack_depot_* name conflict (diff)
parentMerge tag 'mediatek-drm-next-5.17' of https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux into drm-next (diff)
downloadwireguard-linux-1758047057dbe329be712a31b79db7151b5871f8.tar.xz
wireguard-linux-1758047057dbe329be712a31b79db7151b5871f8.zip
Merge drm/drm-next into drm-misc-next-fixes
Backmerging to bring drm-misc-next-fixes up to the latest state for the current release cycle. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Diffstat (limited to 'kernel/time/posix-cpu-timers.c')
-rw-r--r--kernel/time/posix-cpu-timers.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index ee736861b18f..96b4e7810426 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -1159,13 +1159,28 @@ static void posix_cpu_timers_work(struct callback_head *work)
}
/*
+ * Clear existing posix CPU timers task work.
+ */
+void clear_posix_cputimers_work(struct task_struct *p)
+{
+ /*
+ * A copied work entry from the old task is not meaningful, clear it.
+ * N.B. init_task_work will not do this.
+ */
+ memset(&p->posix_cputimers_work.work, 0,
+ sizeof(p->posix_cputimers_work.work));
+ init_task_work(&p->posix_cputimers_work.work,
+ posix_cpu_timers_work);
+ p->posix_cputimers_work.scheduled = false;
+}
+
+/*
* Initialize posix CPU timers task work in init task. Out of line to
* keep the callback static and to avoid header recursion hell.
*/
void __init posix_cputimers_init_work(void)
{
- init_task_work(&current->posix_cputimers_work.work,
- posix_cpu_timers_work);
+ clear_posix_cputimers_work(current);
}
/*
@@ -1404,7 +1419,8 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clkid,
}
}
- *newval += now;
+ if (*newval)
+ *newval += now;
}
/*