localalloc::dealloc tweak size math for large objects
Avoid computing bits::next_pow2_bits(1 << n). Even if the compiler can see through enough of the algebra, it's surely more direct to just use n. While here, slightly expand documentation about what's going on with the "sizeclass" encoded into MetaEntry-s.
This commit is contained in:
committed by
Nathaniel Wesley Filardo
parent
52a4b0c8d0
commit
554db3997d
@@ -77,13 +77,16 @@ namespace snmalloc
|
||||
{
|
||||
if (align_bits >= MIN_CHUNK_BITS)
|
||||
{
|
||||
// The pagemap stores MetaEntrys, abuse the metaslab field to be the
|
||||
// The pagemap stores `MetaEntry`s; abuse the metaslab field to be the
|
||||
// next block in the stack of blocks.
|
||||
//
|
||||
// The pagemap entries here have nullptr (i.e., fake_large_remote) as
|
||||
// their remote, and so other accesses to the pagemap (by
|
||||
// external_pointer, for example) will not attempt to follow this
|
||||
// "Metaslab" pointer.
|
||||
//
|
||||
// dealloc() can reject attempts to free such MetaEntry-s due to the
|
||||
// zero sizeclass.
|
||||
MetaEntry t(reinterpret_cast<Metaslab*>(next.unsafe_ptr()), nullptr, 0);
|
||||
Pagemap::set_metaentry(local_state, address_cast(base), 1, t);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user