Skip to contentSkip to conversation

can kfree sleep?

DISCUSSION Manfred Spraul 2 participants 2 messages Nov 21, 2004

lore
Share & tools
lore
#0 lore raw

Hi Peter,

Quoted 5 lines

Just a question: can kfree sleep?

No, it never sleeps. It's safe to call kfree from arbitrary context. The only exception is the NMI oopser and similar arch code.

Quoted 3 lines

I believe so, but slab.c does not enlighten me immediately:

Yes, the kfree code is quite long - it must check if freeing one object created a freeable page and return it to the page allocator. Together with lots of caching and debug checks.

--
Manfred

#1 lore raw
Quoted 1 line · In article <[email protected]> you wrote:

Hi Peter,

Hi!

Quoted 4 lines
Quoted 2 lines

Just a question: can kfree sleep?

No, it never sleeps. It's safe to call kfree from arbitrary context. The only exception is the NMI oopser and similar arch code.

OK - thanks. I'll take that as read and eliminate kfree from the list of sleep "seeds" in my code analyser.

Quoted 5 lines
Quoted 2 lines

I believe so, but slab.c does not enlighten me immediately:

Yes, the kfree code is quite long - it must check if freeing one object created a freeable page and return it to the page allocator. Together with lots of caching and debug checks.

May I ask where your knowledge of this comes from? (So I can duplicate the learning process)!

Peter