Messages in this thread | | | Subject | Re: in_atomic() & spin_lock / spin_unlock in different functions | From | Robert Love <> | Date | 13 Oct 2002 15:40:09 -0400 |
| |
On Sun, 2002-10-13 at 14:38, Pavel Machek wrote:
> I'm doing spin_lock_irqsave() then in another function > spin_unlock_irqrestore. Is that okay? If no, can it cause "scheduling > in atomic"?
It is not OK if the function is run by a different process. Then one process will have a preempt_count one larger than it should and one would have a preempt_count one smaller.
The task with the one smaller preempt_count will probably cause a crash when it preemptively reschedules erroneously.
In other words, you have:
Process A Process B preempt_count++ preempt_count--
When both of those routines need to be done by the same process.
Also, you cannot use spin_lock_irqsave() in different functions at all on sparc as it contains stack information.
Robert Love
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |