mirror of https://github.com/thesofproject/sof.git
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:
parent
a766e471b0
commit
48145df552
|
@ -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 ? */
|
||||
|
|
Loading…
Reference in New Issue