MCPcopy Create free account
hub / github.com/F-Stack/f-stack / slab_ipers_hdr

Function slab_ipers_hdr

freebsd/vm/uma_core.c:2017–2042  ·  view source on GitHub ↗

* Compute the number of items that will fit in a slab. If hdr is true, the * item count may be limited to provide space in the slab for an inline slab * header. Otherwise, all slab space will be provided for item storage. */

Source from the content-addressed store, hash-verified

2015 * header. Otherwise, all slab space will be provided for item storage.
2016 */
2017static u_int
2018slab_ipers_hdr(u_int size, u_int rsize, u_int slabsize, bool hdr)
2019{
2020 u_int ipers;
2021 u_int padpi;
2022
2023 /* The padding between items is not needed after the last item. */
2024 padpi = rsize - size;
2025
2026 if (hdr) {
2027 /*
2028 * Start with the maximum item count and remove items until
2029 * the slab header first alongside the allocatable memory.
2030 */
2031 for (ipers = MIN(SLAB_MAX_SETSIZE,
2032 (slabsize + padpi - slab_sizeof(1)) / rsize);
2033 ipers > 0 &&
2034 ipers * rsize - padpi + slab_sizeof(ipers) > slabsize;
2035 ipers--)
2036 continue;
2037 } else {
2038 ipers = MIN((slabsize + padpi) / rsize, SLAB_MAX_SETSIZE);
2039 }
2040
2041 return (ipers);
2042}
2043
2044struct keg_layout_result {
2045 u_int format;

Callers 1

keg_layout_oneFunction · 0.85

Calls 1

slab_sizeofFunction · 0.85

Tested by

no test coverage detected