scheduler/interruption doubt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There comes another newbie question for you guys:

I got it while reading the sched.c source file

In the function task_rq_lock(), we can see the 
following code : 

local_irq_save(*flags);
rq = task_rq(p);
spin_lock(&rq->lock);

What happens if a interruption occurs exactly after
local_irq_save() is executed? Wouldn't the state
of flags be changed ? I mean, when spin_lock_irqrestore()
is executed, won't it restore the wrong flags? (obviouly,
in the case that the interrupt occurs) 
After all, what are this code advantages over
some code like:

rq = tasq_rq(p);
spin_lock_irqsave(&rq->lock);
	...
spin_lock_irqrestore(&rq->lock);

???

Any answers is welcome :)


-- 
Fortune:

It is much easier to be critical than to be correct.
		-- Benjamin Disraeli
---
Software Livre 
Tecnologia para um mundo melhor
==============================
Glauber de Oliveira Costa
e-mail: glauber@mpcnet.com.br
jabber: glommer@jabber.org
ICQ # : 18419549
Phone: +55 19 32892120
==============================


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux