lkml.org 
[lkml]   [2019]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch V2 30/38] posix-cpu-timers: Respect INFINITY for hard RTTIME limit
    The RTIME limit expiry code does not check the hard RTTIME limit for
    INFINITY, i.e. being disabled. Add it.

    While this could be considered an ABI breakage if something would depend on
    this behaviour. Though it's highly unlikely to have an effect because
    RLIM_INFINITY is at minimum INT_MAX and the RTTIME limit is in seconds, so
    the timer would fire after ~68 years.

    Adding this obvious correct limit check also allows further consolidation
    of that code and is a prerequisite for cleaning up the 0 based checks and
    the rlimit setter code.

    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    ---
    V2: Documented the theoretical ABI breakage in the changelong
    ---
    kernel/time/posix-cpu-timers.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/kernel/time/posix-cpu-timers.c
    +++ b/kernel/time/posix-cpu-timers.c
    @@ -921,7 +921,7 @@ static void check_process_timers(struct
    unsigned long hard = task_rlimit_max(tsk, RLIMIT_CPU);
    unsigned long psecs = div_u64(ptime, NSEC_PER_SEC);

    - if (psecs >= hard) {
    + if (hard != RLIM_INFINITY && psecs >= hard) {
    /*
    * At the hard limit, we just die.
    * No need to calculate anything else now.

    \
     
     \ /
      Last update: 2019-08-21 21:32    [W:2.223 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site