1. 03 Jul, 2018 3 commits
    • Jameson Miller's avatar
      block alloc: add validations around cache_entry lifecyle · 8616a2d0
      Jameson Miller authored
      Add an option (controlled by an environment variable) perform extra
      validations on mem_pool allocated cache entries. When set:
      
        1) Invalidate cache_entry memory when discarding cache_entry.
      
        2) When discarding index_state struct, verify that all cache_entries
           were allocated from expected mem_pool.
      
        3) When discarding mem_pools, invalidate mem_pool memory.
      
      This should provide extra checks that mem_pools and their allocated
      cache_entries are being used as expected.
      Signed-off-by: 's avatarJameson Miller <jamill@microsoft.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
      8616a2d0
    • Jameson Miller's avatar
      mem-pool: fill out functionality · 0e58301d
      Jameson Miller authored
      Add functions for:
      
          - combining two memory pools
      
          - determining if a memory address is within the range managed by a
            memory pool
      
      These functions will be used by future commits.
      Signed-off-by: 's avatarJameson Miller <jamill@microsoft.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
      0e58301d
    • Jameson Miller's avatar
      mem-pool: add life cycle management functions · 158dfeff
      Jameson Miller authored
      Add initialization and discard functions to mem_pool type. As the
      memory allocated by mem_pool can now be freed, we also track the large
      allocations.
      
      If the there are existing mp_blocks in the mem_poo's linked list of
      mp_blocksl, then the mp_block for a large allocation is inserted
      behind the head block. This is because only the head mp_block is considered
      when searching for availble space. This results in the following
      desirable properties:
      
      1) The mp_block allocated for the large request will not be included
      not included in the search for available in future requests, the large
      mp_block is sized for the specific request and does not contain any
      spare space.
      
      2) The head mp_block will not bumped from considation for future
      memory requests just because a request for a large chunk of memory
      came in.
      
      These changes are in preparation for a future commit that will utilize
      creating and discarding memory pool.
      Signed-off-by: 's avatarJameson Miller <jamill@microsoft.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
      158dfeff
  2. 12 Apr, 2018 1 commit