Re: kmalloc without GFP_xxx?

From: Timur Tabi
Date: Wed Jun 29 2005 - 11:55:08 EST


Denis Vlasenko wrote:

This is why I always use _irqsave. Less error prone.

No, it's just bad programming. How hard can it be to see which spinlocks are being used by your ISR and which ones aren't? Only the ones that your ISR touches should have _irqsave. It's really quite simple.

This is more or less what I meant. Why think about each kmalloc and when you
eventually did get it right: "Aha, we _sometimes_ get called from spinlocked code,
GFP_ATOMIC then" - you still do atomic alloc even if cases when you
were _not_ called from locked code! Thus you needed to think longer and got
code which is worse.

So you're saying that you're the kind of programmer who makes more mistakes the longer you think about something?????

Using GFP_ATOMIC increases the probability that you won't be able to allocate the memory you need, and it also increases the probability that some other module that really needs GFP_ATOMIC will also be unable to allocate the memory it needs. Please tell me, how is this considered good programming?

--
Timur Tabi
Staff Software Engineer
timur.tabi@xxxxxxxxxxx

One thing a Southern boy will never say is,
"I don't think duct tape will fix it."
-- Ed Smylie, NASA engineer for Apollo 13
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/