Page MenuHomeFreeBSD

uma: deduplicate uma_small_alloc
ClosedPublic

Authored by bnovkov on May 3 2024, 8:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jul 13, 1:03 AM
Unknown Object (File)
Tue, Jul 9, 4:21 PM
Unknown Object (File)
Sat, Jul 6, 6:14 PM
Unknown Object (File)
Thu, Jul 4, 7:30 AM
Unknown Object (File)
Fri, Jun 28, 8:24 AM
Unknown Object (File)
Thu, Jun 27, 8:53 PM
Unknown Object (File)
Jun 13 2024, 6:29 PM
Unknown Object (File)
Jun 13 2024, 6:29 PM

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

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

sys/powerpc/powerpc/uma_machdep.c
41

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

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.May 13 2024, 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.May 13 2024, 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.May 14 2024, 4:35 PM
This revision was automatically updated to reflect the committed changes.