<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 23, 2018 at 8:33 AM, Scott D Phillips <span dir="ltr"><<a href="mailto:scott.d.phillips@intel.com" target="_blank">scott.d.phillips@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> writes:<br>
<br>
> Previously, we only tried to ensure that we didn't shrink either end<br>
> below what was already handed out. However, due to the way we handle<br>
> relocations with block pools, we can't shrink the back end at all. It's<br>
> probably best to not shrink in either direction.<br>
><br>
> Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=105374" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=105374</a><br>
> Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=106147" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=106147</a><br>
> Cc: <a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.<wbr>org</a><br>
> ---<br>
> src/intel/vulkan/anv_<wbr>allocator.c | 8 ++++----<br>
> 1 file changed, 4 insertions(+), 4 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/anv_<wbr>allocator.c b/src/intel/vulkan/anv_<wbr>allocator.c<br>
> index f884ac3..642e161 100644<br>
> --- a/src/intel/vulkan/anv_<wbr>allocator.c<br>
> +++ b/src/intel/vulkan/anv_<wbr>allocator.c<br>
> @@ -508,12 +508,12 @@ anv_block_pool_grow(struct anv_block_pool *pool, struct anv_block_state *state)<br>
<br>
> assert(center_bo_offset >= back_used);<br>
> <br>
> /* Make sure we don't shrink the back end of the pool */<br>
> - if (center_bo_offset < pool->back_state.end)<br>
> - center_bo_offset = pool->back_state.end;<br>
> + if (center_bo_offset < back_required)<br>
> + center_bo_offset = back_required;<br>
> /* Make sure that we don't shrink the front end of the pool */<br>
> - if (size - center_bo_offset < pool->state.end)<br>
> - center_bo_offset = size - pool->state.end;<br>
> + if (size - center_bo_offset < front_required)<br>
> + center_bo_offset = size - front_required;<br>
<br>
</div></div>Reading through the function, it's not clear to me what condition will<br>
lead to a possible shrinking of one side or the other here. Regardless,<br>
any calculation here based on .end, the old size, seems like it would<br>
have to be wrong because we're trying to satisfy the post condition that<br>
there is enough room for .next on each side. So,<br></blockquote><div><br></div><div>The problem is that he balancing algorithm above this isn't perfect and can accidentally try to shrink one side or the other. The logic fixed here was intended to prevent that but didn't prevent it hard enough.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Reviewed-by: Scott D Phillips <<a href="mailto:scott.d.phillips@intel.com">scott.d.phillips@intel.com</a>><span class="im HOEnZb"></span><br></blockquote></div><br></div><div class="gmail_extra">Thanks!<br></div></div>