[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87pri7k4id.fsf@basil.nowhere.org>
Date: Wed, 28 Jan 2009 13:18:50 +0100
From: Andi Kleen <andi@...stfloor.org>
To: Roger Larsson <roger.larsson@...atan.se>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
Robert Love <rml@...h9.net>, Pavel Machek <pavel@....cz>,
netdev@...r.kernel.org
Subject: Re: PROBLEM: in_atomic() misuse all over the place
Roger Larsson <roger.larsson@...atan.se> writes:
[cc netdev since network code is discussed]
> [2.] Full description of the problem/report:
>
> The problem is that in_atomic() only works on preemptive kernels...
That's not fully correct. It works in tasklets/softirqs/spin_lock_bh
on all kernels.
> file: include/net/sock.h
>
> static inline gfp_t gfp_any(void)
> {
> return in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
> }
That's typically for softirq vs non softirq, which is important
for the network stack.
That said its undoubtedly possible that some users get
it wrong and assume it applies to spinlocks (without _bh) too.
But at least the classical uses in the network stack should be ok.
I personally would consider anyone using it inside a normal
spinlock dubious anyways, because GFP_ATOMIC is the wrong
thing to use here. The correct way is to either switch to a mutex/sem
or move the allocation outside the lock.
-Andi
--
ak@...ux.intel.com -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists