Disable task rescheduling

Eugene Surovegin ebs at ebshome.net
Tue Jun 21 04:22:40 EST 2005


On Mon, Jun 20, 2005 at 03:12:03PM +0200, Garcia J?r?mie wrote:
> Hi everybody, as teh object of this mail tells, I'd like to know if there is an easy way
> to disable task rescheduling in the kernel.
> I explain: I'm writing a device driver and so, I use the ioctl.
> In one of my ioctl's, I'd like to have a non-interruptible part processed.
> 
> int Hscx_ioctl(        struct inode *inode,
>                        struct file *file,
>                        unsigned int ioctl_num,     /* Number of the ioctl to call    */
>                        unsigned long argP)         /* Paramater to pass to the ioctl */
> {
>    [...]
>    switch(ioctl_num)
>    {
>          case GET_LIST:
>          
>              disable_task_rescheduling();  // what to use???
>              disable_interrupt();          // spin_lock_irqsave should be enough isn't it?
> 
>              execute_critical_code();
> 
>              enable_task_rescheduling();   // what to use???
>              enable_interrupt();           // spin_unlock_irqrestore should be enough isn't it?
>              break;
>    }
> }

Disabling interrupts (with spin_lock_irq) also disables kernel 
preemption (if enabled, if not - kernel won't preempt current task 
anyway when in the driver), so explicitly disable 
(disable_task_rescheduling) isn't needed.

-- 
Eugene




More information about the Linuxppc-dev mailing list