summaryrefslogtreecommitdiff
path: root/kernel/sys.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2019-08-21 22:09:19 +0300
committerThomas Gleixner <tglx@linutronix.de>2019-08-28 12:50:40 +0300
commit2bbdbdae05167c688b6d3499a7dab74208b80a22 (patch)
tree7731020cb6763b1c4fd314b39acff07855b2a894 /kernel/sys.c
parent24db4dd90dd53ad6e3331b6f01cb985e466cface (diff)
downloadlinux-2bbdbdae05167c688b6d3499a7dab74208b80a22.tar.xz
posix-cpu-timers: Get rid of zero checks
Deactivation of the expiry cache is done by setting all clock caches to 0. That requires to have a check for zero in all places which update the expiry cache: if (cache == 0 || new < cache) cache = new; Use U64_MAX as the deactivated value, which allows to remove the zero checks when updating the cache and reduces it to the obvious check: if (new < cache) cache = new; This also removes the weird workaround in do_prlimit() which was required to convert a RLIMIT_CPU value of 0 (immediate expiry) to 1 because handing in 0 to the posix CPU timer code would have effectively disarmed it. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lkml.kernel.org/r/20190821192922.275086128@linutronix.de
Diffstat (limited to 'kernel/sys.c')
-rw-r--r--kernel/sys.c9
1 files changed, 0 insertions, 9 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index c578b75d7923..2462aa84247f 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1557,15 +1557,6 @@ int do_prlimit(struct task_struct *tsk, unsigned int resource,
retval = -EPERM;
if (!retval)
retval = security_task_setrlimit(tsk, resource, new_rlim);
- if (resource == RLIMIT_CPU && new_rlim->rlim_cur == 0) {
- /*
- * The caller is asking for an immediate RLIMIT_CPU
- * expiry. But we use the zero value to mean "it was
- * never set". So let's cheat and make it one second
- * instead
- */
- new_rlim->rlim_cur = 1;
- }
}
if (!retval) {
if (old_rlim)