alloc: optimise the contiguous block allocation algorithm

If we found a busy block among the potential sequence of blocks, that
we were trying to allocate, no need to retry the attempt from the
next starting block, unless it was the first block, that was busy. It
is enough to resume searching from the next block after the busy one.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2019-01-17 09:51:37 +01:00 committed by Liam Girdwood
parent a766e471b0
commit 48145df552
1 changed files with 4 additions and 1 deletions

View File

@ -264,8 +264,11 @@ static void *alloc_cont_blocks(struct mm_heap *heap, int level,
hdr = &map->block[current];
/* is block used */
if (hdr->used)
if (hdr->used) {
/* continue after the "current" */
start = current;
break;
}
}
/* enough free blocks ? */