]> Git Repo - linux.git/commit
posix-timers: fix RLIMIT_CPU && setitimer(CPUCLOCK_PROF)
authorOleg Nesterov <[email protected]>
Fri, 27 Mar 2009 00:06:10 +0000 (01:06 +0100)
committerIngo Molnar <[email protected]>
Wed, 8 Apr 2009 15:51:39 +0000 (17:51 +0200)
commit8f2e586567b1bad72dac7c3810fe9a2ef7117506
tree23da00a7e4b78f71c5d32ba350d0039b5016124e
parent6279a751fe096a21dc7704e918d570d3ff06e769
posix-timers: fix RLIMIT_CPU && setitimer(CPUCLOCK_PROF)

update_rlimit_cpu() tries to optimize out set_process_cpu_timer() in case
when we already have CPUCLOCK_PROF timer which should expire first. But it
uses cputime_lt() instead of cputime_gt().

Test case:

int main(void)
{
struct itimerval it = {
.it_value = { .tv_sec = 1000 },
};

assert(!setitimer(ITIMER_PROF, &it, NULL));

struct rlimit rl = {
.rlim_cur = 1,
.rlim_max = 1,
};

assert(!setrlimit(RLIMIT_CPU, &rl));

for (;;)
;

return 0;
}

Without this patch, the task is not killed as RLIMIT_CPU demands.

Signed-off-by: Oleg Nesterov <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Cc: Peter Lojkin <[email protected]>
Cc: Roland McGrath <[email protected]>
Cc: [email protected]
LKML-Reference: <20090327000610[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
kernel/posix-cpu-timers.c
This page took 0.060683 seconds and 4 git commands to generate.