mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-26 14:17:26 -04:00
percpu: manage chunks based on contig_bits instead of free_bytes
When a chunk becomes fragmented, it can end up having a large number of small allocation areas free. The free_bytes sorting of chunks leads to unnecessary checking of chunks that cannot satisfy the allocation. Switch to contig_bits sorting to prevent scanning chunks that may not be able to service the allocation request. Signed-off-by: Dennis Zhou <dennis@kernel.org> Reviewed-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
parent
d9f3a01eeb
commit
3e54097beb
1 changed files with 1 additions and 1 deletions
|
@ -234,7 +234,7 @@ static int pcpu_chunk_slot(const struct pcpu_chunk *chunk)
|
||||||
if (chunk->free_bytes < PCPU_MIN_ALLOC_SIZE || chunk->contig_bits == 0)
|
if (chunk->free_bytes < PCPU_MIN_ALLOC_SIZE || chunk->contig_bits == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return pcpu_size_to_slot(chunk->free_bytes);
|
return pcpu_size_to_slot(chunk->contig_bits * PCPU_MIN_ALLOC_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the pointer to a chunk in a page struct */
|
/* set the pointer to a chunk in a page struct */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue