linux hrtimer affinity
Hi all, Is there a way to set the affinity of hrtimer callback, so that it executes on a particular logical CPU? The reason is that I have a hrtimer callback that executes a tasklet. If the timer callback executes on a different CPU than the one it was enqueued in, then the tasklet is scheduled on the same CPU, which makes it difficult to reason serialising locks to per-CPU data structures. Any ideas? Thanks, -- Vimal
On Wed, Feb 15, 2012 at 12:06 AM, Vimal <j.vimal@gmail.com> wrote:
Hi all,
Is there a way to set the affinity of hrtimer callback, so that it executes on a particular logical CPU?
The reason is that I have a hrtimer callback that executes a tasklet.
If the timer callback executes on a different CPU than the one it was
enqueued in, then the tasklet is scheduled on the same CPU, which makes it difficult to reason serialising locks to per-CPU data
How about this: http://www.makelinux.net/ldd3/chp-7-sect-5 Tasklet is executed and scheduled on a particular known cpu, so unless u spawn another tasklet that execute on the other CPU, u don't need per-CPU data structure - simply because there is no another CPU to contend with the data structure. Not sure if I got the point? I am not sure why u need to synchronize stuff "between CPU", as a particular tasklet is only executed on only one CPU at a time: I suspect what u wanted is a "task". A tasklet is effectively a "bottom half" and u are holding a spinlock while executing it, and thus it really has to be very fast. Read this paper: http://www.wil.cx/matthew/lca2003/paper.pdf structures.
Any ideas?
Thanks, -- Vimal
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Regards, Peter Teoh
Read this: http://lwn.net/Articles/296578/ Take note there are several apis available: schedule_hrtimeout, schedule_hrtimeout_range, schedule_timeout, schedule_timeout_range, schedule_timeout_uninterruptible etc. On Mon, Feb 20, 2012 at 7:50 AM, Peter Teoh <htmldeveloper@gmail.com> wrote:
On Wed, Feb 15, 2012 at 12:06 AM, Vimal <j.vimal@gmail.com> wrote:
Hi all,
Is there a way to set the affinity of hrtimer callback, so that it executes on a particular logical CPU?
The reason is that I have a hrtimer callback that executes a tasklet.
If the timer callback executes on a different CPU than the one it was
enqueued in, then the tasklet is scheduled on the same CPU, which makes it difficult to reason serialising locks to per-CPU data
How about this:
http://www.makelinux.net/ldd3/chp-7-sect-5
Tasklet is executed and scheduled on a particular known cpu, so unless u spawn another tasklet that execute on the other CPU, u don't need per-CPU data structure - simply because there is no another CPU to contend with the data structure. Not sure if I got the point?
I am not sure why u need to synchronize stuff "between CPU", as a particular tasklet is only executed on only one CPU at a time:
I suspect what u wanted is a "task". A tasklet is effectively a "bottom half" and u are holding a spinlock while executing it, and thus it really has to be very fast. Read this paper:
http://www.wil.cx/matthew/lca2003/paper.pdf
structures.
Any ideas?
Thanks, -- Vimal
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Regards, Peter Teoh
-- Regards, Peter Teoh
participants (2)
-
Peter Teoh -
Vimal