Subject: [PATCH v4 0/8] Allocate cache entries from mem_pool

From: Jameson Miller <[email-masked]>
Date: Wed, 20 Jun 2018 20:17:23 +0000

Changes from V3:

Mainly changes from last round of feedback:

  - Rename make_index_cache_entry -> make_cache_entry

  - Rename make_empty_index_cache_entry -> make_empty-cache_entry

  - Remove tail pointer in mem_pool

  - Small code tweaks

  - More accurately calculate mp_block size for platforms that do not
    support flexible arrays

One thing that came up with my testing is that the current automated
tests do not fully cover the code path of "large" allocations from a
memory pool. I was able to force this condition by manually tweaking
some variables and then running the automated tests, but this is not
ideal for preventing regressions in the future.

One way I can think of testing this is to add a test-helper and
directly test the memory pool struct. This will allow me to control
the parameters and different conditions. I was hoping for some
guidance before I actually implemented these tests.

Either way, I would like to do the additional tests in a separate
patch series to have a more focused discussion. I am not sure if these
tests would prevent inclusion of this patch series - I am open to
guidance here.

Base Ref: master
Web-Diff: https://github.com/jamill/git/compare/242ba98e44...667b8de06c

Jameson Miller (8):
  read-cache: teach refresh_cache_entry() to take istate
  block alloc: add lifecycle APIs for cache_entry structs
  mem-pool: only search head block for available space
  mem-pool: tweak math on mp_block allocation size
  mem-pool: add lifecycle management functions
  mem-pool: fill out functionality
  block alloc: allocate cache entries from mem_pool
  block alloc: add validations around cache_entry lifecyle

 apply.c                |  24 +++--
 blame.c                |   5 +-
 builtin/checkout.c     |   8 +-
 builtin/difftool.c     |   6 +-
 builtin/reset.c        |   2 +-
 builtin/update-index.c |  26 +++--
 cache.h                |  53 +++++++++-
 git.c                  |   3 +
 mem-pool.c             | 124 +++++++++++++++++++----
 mem-pool.h             |  23 +++++
 merge-recursive.c      |   4 +-
 read-cache.c           | 259 ++++++++++++++++++++++++++++++++++++++++---------
 resolve-undo.c         |   4 +-
 split-index.c          |  58 ++++++++---
 tree.c                 |   4 +-
 unpack-trees.c         |  40 ++++----
 16 files changed, 504 insertions(+), 139 deletions(-)

base-commit: 242ba98e44d8314fb184d240939614a3c9b424db
-- 
2.14.3