Skip to content

Commit

Permalink
percpu: manage chunks based on contig_bits instead of free_bytes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dennis Zhou committed Mar 13, 2019
1 parent d9f3a01 commit 3e54097
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/percpu.c
Original file line number Diff line number Diff line change
@@ -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)
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 */

0 comments on commit 3e54097

Please sign in to comment.