[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a36005b50705012157p15eee224o5511e60c4a956bd@mail.gmail.com>
Date: Tue, 1 May 2007 21:57:25 -0700
From: "Ulrich Drepper" <drepper@...il.com>
To: "Theodore Tso" <tytso@....edu>,
"Ulrich Drepper" <drepper@...il.com>,
"Bill Irwin" <bill.irwin@...cle.com>,
"Andrew Morton" <akpm@...ux-foundation.org>,
"Eric Dumazet" <dada1@...mosbay.com>, linux-kernel@...r.kernel.org,
wli@...omorphy.com
Subject: Re: per-thread rusage
On 5/1/07, Theodore Tso <tytso@....edu> wrote:
> The question is should we use setrlimit() to set the per-thread CPU
> limit, given that we would need some separate interface to set signal
> that should be sent.
>
> Is there any reason why we should have the interface specify whether
> the signal should be directed to a specified process or kernel
> thread-id, perhaps using si_pid field in the siginfo_t to specify
> which thread had exceeded its CPU limit. Or would this be overkill?
The more I think about it the more complex it gets. There is a
problem with delivering the signal to the receiving process itself: it
is out of time and cannot perform the cleanup operation anymore. You
could grant it a grace period but how long should that be? Some of
the cleanup handlers might take a long time. If you don't enforce the
CPU limit then it doesn't have to be in the kernel and you might as
well use CLOCK_THREAD_CPUTIME_ID and create a timer. This should
already work today. If not it must be fixed.
Delivering the timeout signal to another thread isn't really possible
either since the cleanup code might access thread-local data which
wouldn't work since it's not the canceled thread's data which is
accessed.
I don't have a good answer right now whether enforced CPU limits can
be implemented at all. But it seems for your purposes a timer with
the CPU clock might be sufficient.
> Do you think this is something that we could get standardized into an
> upcoming Posix/Posix Threads standard?
Regardless of whether a solution can be found, it's too late for the
next revision. The deadline for new features is long gone by.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists