rescheduling tasks using swi_add()

John Baldwin jhb at freebsd.org
Wed Jan 11 06:20:27 PST 2006


On Wednesday 11 January 2006 07:13 am, kamal kc wrote:
> dear everybody,
>
> i had previous thread going on about the cpu load
> average. and had some discussion regarding it. i have
> a newer thing to discuss on so i started this thread.
>
> as i mentioned earlier i had put some code in the
> bridge.c
> that performed compression which took a long time and
> hence
> i got a high number of interface interrupts (irq22: xl
> interrupts).
>
> so i thought of rescheduling the compression tasks
> without
> blocking the bridge function. i found this function
> swi_add()
> which i could use to add software interrupt handlers
> that
> could be run at a later time without causing high
> interface
> interrupts.
>
> the man page discussed the swi_add() and swi_sched()
> functions.
>
> what i don't understand is, how do i register my
> handler
> function ??
> if i use the swi_add() for that purpose what
> do i use for the void *arg argument.
>
> and how can i dispatch control to the software
> interrupt handler ??
> the swi_sched() uses only the cookie and the flags
> arguments.
> there is no way i can pass arguments to my handler
> function ..
>
> i guess most of you are familiar with this and can
> help me
> out ......

Queue a task to a taskqueue.  Behind the scenes that will invoke a swi_add if 
you use the taskqueue_swi queue.  However, given that you want to do some 
rather complicated work, you'd be better off creating a dedicated taskqueue 
thread and queueing tasks off to it I think.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-hackers mailing list