Patch "posix-cpu-timers: Force next expiration recalc after itimer reset" has been added to the 5.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    posix-cpu-timers: Force next expiration recalc after itimer reset

to the 5.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     posix-cpu-timers-force-next-expiration-recalc-after-.patch
and it can be found in the queue-5.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit bb9824a82c0c439f15a09c989f1e160cba7334e6
Author: Frederic Weisbecker <frederic@xxxxxxxxxx>
Date:   Mon Jul 26 14:55:10 2021 +0200

    posix-cpu-timers: Force next expiration recalc after itimer reset
    
    [ Upstream commit 406dd42bd1ba0c01babf9cde169bb319e52f6147 ]
    
    When an itimer deactivates a previously armed expiration, it simply doesn't
    do anything. As a result the process wide cputime counter keeps running and
    the tick dependency stays set until it reaches the old ghost expiration
    value.
    
    This can be reproduced with the following snippet:
    
            void trigger_process_counter(void)
            {
                    struct itimerval n = {};
    
                    n.it_value.tv_sec = 100;
                    setitimer(ITIMER_VIRTUAL, &n, NULL);
                    n.it_value.tv_sec = 0;
                    setitimer(ITIMER_VIRTUAL, &n, NULL);
            }
    
    Fix this with resetting the relevant base expiration. This is similar to
    disarming a timer.
    
    Signed-off-by: Frederic Weisbecker <frederic@xxxxxxxxxx>
    Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
    Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210726125513.271824-4-frederic@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 517be7fd175e..a002685f688d 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -1346,8 +1346,6 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clkid,
 			}
 		}
 
-		if (!*newval)
-			return;
 		*newval += now;
 	}
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux