Page MenuHomeFreeBSD

uma: deduplicate uma_small_alloc
AcceptedPublic

Authored by bnovkov on Fri, May 3, 8:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 13, 7:34 AM
Unknown Object (File)
Mon, May 13, 7:34 AM
Unknown Object (File)
Sat, May 11, 10:04 PM
Unknown Object (File)
Thu, May 9, 5:14 PM
Unknown Object (File)
Tue, May 7, 8:34 PM
Unknown Object (File)
Sat, May 4, 4:35 AM

Details

Summary

This patch refactors the UMA small alloc code and removes most UMA machine-dependent code.

The existing machine-dependent uma_small_alloc code was almost identical across all architectures, except for powerpc where using the direct map addresses involved extra steps in some cases.

The MI/MD split was replaced by a default uma_small_alloc implementation that can be overridden by architecture-specific code by defining the UMA_MD_SMALL_ALLOC symbol.
Furthermore, UMA_USE_DMAP was introduced to replace most UMA_MD_SMALL_ALLOC uses.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/powerpc/powerpc/uma_machdep.c
41 ↗(On Diff #138121)

Do you really need this guard? It seems to be always true.

sys/powerpc/powerpc/uma_machdep.c
41 ↗(On Diff #138121)

I added it since powerpc's vmparam.h does not define it for 32 bit Book-E (lines 131-133).
However, I'm not that well acquainted with powerpc so I don't know if that combination is even possible.

sys/powerpc/powerpc/uma_machdep.c
41 ↗(On Diff #138121)

Reading the code, it looks like we can unconditionally enable UMA_MD_SMALL_ALLOC for all powerpc. I think it wasn't set before is that we assumed a DMAP, which 32-bit Book-E cannot have. The code path has evolved to handle it, though.

markj added inline comments.
sys/vm/uma_core.c
2083

This can be static, right? Or does that make supporting UMA_MD_SMALL_ALLOC difficult?

2084

since you're moving this code anyway. The old u_int*_t typedefs are deprecated.

2168
This revision is now accepted and ready to land.Mon, May 13, 1:16 PM

Address multiple comments:

  • enabled UMA_MD_SMALL_ALLOC unconditionally
  • removed redundant include guard in ppc uma_machdep
  • removed obsolete u_int8_t types
This revision now requires review to proceed.Mon, May 13, 7:15 PM
bnovkov added inline comments.
sys/vm/uma_core.c
2083

I don't think so, it would cause a 'static declaration follows non-static declaration' type of error on platforms that don't define UMA_MD_SMALL_ALLOC.

markj added inline comments.
sys/vm/uma_core.c
2083

Right, but you can guard the declarations with UMA_MD_SMALL_ALLOC. I don't have a strong feeling either way on that though.

This revision is now accepted and ready to land.Tue, May 14, 4:35 PM