[PATCH -next 0/1] Restart rt period timer when rt runtime exceeded

From: Li Hua
Date: Sun Nov 14 2021 - 20:28:30 EST


When rt_runtime is modified from -1 to a valid control value, it may cause
the task to be throttled all the time. Then the task cannot be killed.
E.g:
The FIFO task A execution while(1):
#define _GNU_SOURCE
#include <sched.h>
#include <unistd.h>

int main(int argc,char *argv[])
{
struct sched_param param;
int priority = sched_get_priority_min(SCHED_FIFO);
param.sched_priority = priority;
sched_setscheduler(getpid(), SCHED_FIFO, &param);
while(1) {}
return 0;
}

Following the steps:
lihua@octopus ~ # echo -1 > /proc/sys/kernel/sched_rt_runtime_us
lihua@octopus ~ # /bin/rt_throttled &
lihua@octopus ~ # echo 950000 > /proc/sys/kernel/sched_rt_runtime_us
lihua@octopus ~ # ps aux | grep rt_throttled
root 7026 65.1 0.0 1848 180 ttyAMA0 R 01:27 0:26 /bin/rt_throttled
root 7068 0.0 0.0 4072 620 ttyAMA0 S+ 01:28 0:00 grep rt_throttled
lihua@octopus ~ # killall rt_throttled
lihua@octopus ~ # date
Thu Jan 1 01:28:30 UTC 1970
lihua@octopus ~ # date
Thu Jan 1 01:28:33 UTC 1970
lihua@octopus ~ # ps aux | grep rt_throttled
root 7026 41.0 0.0 1848 180 ttyAMA0 R 01:27 0:26 /bin/rt_throttled
root 7097 0.0 0.0 4072 576 ttyAMA0 S+ 01:28 0:00 grep rt_throttled

So the patch try to wake up the timer when rt runtime exceeded.

*** BLURB HERE ***

Li Hua (1):
sched/rt: Try to restart rt period timer when rt runtime exceeded

kernel/sched/rt.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

--
2.17.1