* Widespread misuse of GFP_ATOMIC
@ 2016-04-10 23:32 coypu
2016-04-11 5:27 ` Julia Lawall
2016-04-11 6:07 ` Dan Carpenter
0 siblings, 2 replies; 3+ messages in thread
From: coypu @ 2016-04-10 23:32 UTC (permalink / raw)
To: kernel-janitors
Hello linux janitors,
from kmalloc man page:
GFP_ATOMIC - Allocation will not sleep. May use emergency pools. For
example, use this inside interrupt handlers.
GFP_NOWAIT - Allocation will not sleep.
grepping linux kernel tree:
[0:/usr/linux-src> ]$ grep -R GFP_ATOMIC . |wc -l
4452
[0:/usr/linux-src> ]$ grep -R GFP_NOWAIT . |wc -l
220
(alternative flags and some accounting:
total k.*alloc calls: 34320
GFP_KERNEL appearances: 23819
GDP_ATOMIC appearances: 4452
GFP_NOWAIT appearances: 220
unaccounted: 5829)
GFP_ATOMIC is meant for interrupt handlers and emergency pool.
Widespread misuse renders the emergency pool useless.
I believe the vast majority of such uses can be converted to GFP_NOWAIT.
Even valid uses of GFP_ATOMIC are likely rendered useless by this
widespread misuse.
You may wish to replace such calls.
Cheers, coypu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Widespread misuse of GFP_ATOMIC
2016-04-10 23:32 Widespread misuse of GFP_ATOMIC coypu
@ 2016-04-11 5:27 ` Julia Lawall
2016-04-11 6:07 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2016-04-11 5:27 UTC (permalink / raw)
To: kernel-janitors
On Sun, 10 Apr 2016, coypu@SDF.ORG wrote:
> Hello linux janitors,
>
> from kmalloc man page:
>
> GFP_ATOMIC - Allocation will not sleep. May use emergency pools. For
> example, use this inside interrupt handlers.
> GFP_NOWAIT - Allocation will not sleep.
>
> grepping linux kernel tree:
>
> [0:/usr/linux-src> ]$ grep -R GFP_ATOMIC . |wc -l
> 4452
> [0:/usr/linux-src> ]$ grep -R GFP_NOWAIT . |wc -l
> 220
>
> (alternative flags and some accounting:
> total k.*alloc calls: 34320
> GFP_KERNEL appearances: 23819
> GDP_ATOMIC appearances: 4452
> GFP_NOWAIT appearances: 220
>
> unaccounted: 5829)
>
> GFP_ATOMIC is meant for interrupt handlers and emergency pool.
> Widespread misuse renders the emergency pool useless.
>
> I believe the vast majority of such uses can be converted to GFP_NOWAIT.
> Even valid uses of GFP_ATOMIC are likely rendered useless by this
> widespread misuse.
>
> You may wish to replace such calls.
How does one know which need the emergency pool?
julia
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Widespread misuse of GFP_ATOMIC
2016-04-10 23:32 Widespread misuse of GFP_ATOMIC coypu
2016-04-11 5:27 ` Julia Lawall
@ 2016-04-11 6:07 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2016-04-11 6:07 UTC (permalink / raw)
To: kernel-janitors
GFP_NOWAIT is when you have a somewhat painless backup plan in case the
allocation fails. If you're worried that there are too many
GFP_ATOMICs, then it's better to re-arrange the code so the allocation
can sleep.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-11 6:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-10 23:32 Widespread misuse of GFP_ATOMIC coypu
2016-04-11 5:27 ` Julia Lawall
2016-04-11 6:07 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).