[lkml]   [2019]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 4/5] locking/lockdep: Reuse free chain_hlocks entries
On Fri, Dec 13, 2019 at 11:02:46AM -0500, Waiman Long wrote:

> That is an interesting idea. It will eliminate the need of a separate
> array to track the free chain_hlocks. However, if there are n chains
> available, it will waste about 3n bytes of storage, on average.
> I have a slightly different idea. I will enforce a minimum allocation
> size of 2. For a free block, the first 2 hlocks for each allocation
> block will store a 32-bit integer (hlock[0] << 16)|hlock[1]:
> Bit 31: always 1
> Bits 24-30: block size
> Bits 0-23: index to the next free block.

If you look closely at the proposed allocator, my blocks can be much
larger than 7 bit. In fact, it start with a single block of

That said; I don't think you need to encode the size at all. All we need
to do is encode the chain_blocks[] index (and stick init_block in that
array). That should maybe even fit in a single u16.

Also, if we store that in the first and last 'word' of the free range,
we can detect both before and after freespace.

> In this way, the wasted space will be k bytes where k is the number of
> 1-entry chains. I don't think merging adjacent blocks will be that
> useful at this point. We can always add this capability later on if it
> is found to be useful.

I'm thinking 1 entry isn't much of a chain. My brain is completely fried
atm, but are we really storing single entry 'chains' ? It seems to me we
could skip that.

 \ /
  Last update: 2019-12-13 19:14    [W:0.100 / U:2.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site