Page MenuHomeFreeBSD

LinuxKPI; cleanup slab.h a bit; move more free() into slab.c
ClosedPublic

Authored by bz on Sat, Mar 29, 6:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 22, 8:26 PM
Unknown Object (File)
Tue, Apr 22, 11:21 AM
Unknown Object (File)
Tue, Apr 22, 8:16 AM
Unknown Object (File)
Tue, Apr 22, 8:13 AM
Unknown Object (File)
Tue, Apr 22, 8:09 AM
Unknown Object (File)
Tue, Apr 22, 6:12 AM
Unknown Object (File)
Tue, Apr 22, 5:53 AM
Unknown Object (File)
Tue, Apr 22, 5:37 AM
Subscribers

Details

Summary

Move kfree() into slab.c as an implementation and hide the private
function linux_kfree_async() entirely.

Remove a ; at the end of a define and sort some defines into place.

Remove extern from function declarations and move the closer to where
they belong.

Sort the functions into "base allocator/free" functions--these have
an implementation in slab.c and are ensuring contiguous physical
memory allocations.

Followed by inline functions using these base allocators to implement
their functionality; vmalloc/kvalloc, and misc functions.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bz requested review of this revision.Sat, Mar 29, 6:35 PM

The patch makes the code a lot clearer, thank you!

I added two comments to further clean up the code.

sys/compat/linuxkpi/common/include/linux/slab.h
171–172

Should linux_check_m_flags() be used closer to the native *alloc() calls only?

The underlying lkpi___kmalloc() function already does it. Using it too early might clear some flags that lkpi___kmalloc() interprets in the future.

234–237

Likewise here, I think linux_check_m_flags() is called too early.

bz marked 2 inline comments as done.

Remove two extra calls to linux_check_m_flags() where the underlying alloc
functions deal with that as pointed out by @dumbbell.

sys/compat/linuxkpi/common/include/linux/slab.h
234–237

Good catches. Updated.

This revision is now accepted and ready to land.Tue, Apr 1, 3:52 PM