Re: programming for preemption (was: [PATCH] 2.5.46: access permission filesystem)

Olaf Dietsche
2002-11-11T17:39:13Z

Andrew Morton <akpm@digeo.com> writes:

> Olaf Dietsche wrote:
>>
>> Ben Clifford <benc@hawaga.org.uk> writes:
>>
>> > I still get those stack traces, though...
>>
>> I retested with CONFIG_PREEMPT=y and now I get those stack traces,
>> too. So, it seems my code is not preempt safe.
>>
>
> It's not that your code is unsafe with preemption. It's just that
> CONFIG_PREEMPT=y turns on the debugging infrastructure which allows
> us to detect things like calling kmalloc(GFP_KERNEL) inside spinlock.

Thanks for this hint. So this means kmalloc(GFP_KERNEL) inside
spinlock is not necessarily dangerous, but should be avoided if
possible? Is using a semaphore better than using spinlocks? Is
there a list of dos and don'ts for preempt kernels beside
Documentation/preempt-locking.txt?

And btw, who is "us"?

Regards, Olaf.