> On 10/9/2019 7:44 PM, Jonathan Tan wrote: > > Instead, recompute ancestry if we ever need to reclaim memory. > > I find this message lacking in important details: > > 1. Where do we recompute ancestry? > 2. What are the performance implications of this change? > 3. Why is it important that you construct a stack of deltas in prune_base_data()? Thanks for taking a look at this. My original plan (as I perhaps badly explained in the cover letter [1]) was to show the individual small steps that I took to reach the end goal, each step still passing all tests, in the hope that small steps are easier to understand than one big one. Hence why I didn't explain much in this commit message (and others), because I thought that I might have to squash them later. But perhaps that is too confusing and I should have just squashed them in the first place (and explain all the changes in the commit message - it's +177 -198, which is not too big anyway). To answer the question anyway, the short answer is that it doesn't matter because I'm going to replace this mechanism in later patches. But a longer answer: 1. In prune_base_delta() (the stack of deltas you mention in question 3). 2. Slightly fewer pointer management during the normal course of operation, but an allocation if we ever need to reclaim memory. 3. To recompute the ancestry. We have ancestry using the "base" pointer, but I need to iterate from the oldest to newest, so I create an array of all the "base" pointers and iterate in reverse. [1] https://public-inbox.org/git/cover.1570663470.git.jonathantanmy@xxxxxxxxxx/ > > static void link_base_data(struct base_data *base, struct base_data *c) > > { > > - if (base) > > - base->child = c; > > - else > > - get_thread_data()->base_cache = c; > > - > > c->base = base; > > - c->child = NULL; > > if (c->data) > > get_thread_data()->base_cache_used += c->size; > > prune_base_data(c); > > @@ -408,11 +416,6 @@ static void link_base_data(struct base_data *base, struct base_data *c) > > > > static void unlink_base_data(struct base_data *c) > > { > > - struct base_data *base = c->base; > > - if (base) > > - base->child = NULL; > > - else > > - get_thread_data()->base_cache = NULL; > > free_base_data(c); > > } > > Seems like this method should be removed and all callers should > call free_base_data() instead. I agree, and did it in the next patch. Here I left it to preserve the {link,unlink}_base_data symmetry.