summaryrefslogtreecommitdiffstats
path: root/mm/percpu.c
diff options
context:
space:
mode:
authorDennis Zhou <dennis@kernel.org>2019-02-25 22:43:38 +0100
committerDennis Zhou <dennis@kernel.org>2019-03-13 20:25:31 +0100
commit3e54097beb228ddcd73bb2fd18bafaa1062e9fe4 (patch)
treec590379baa9cf76ece70f004f598f3ef2827bde5 /mm/percpu.c
parentpercpu: introduce helper to determine if two regions overlap (diff)
downloadlinux-3e54097beb228ddcd73bb2fd18bafaa1062e9fe4.tar.xz
linux-3e54097beb228ddcd73bb2fd18bafaa1062e9fe4.zip
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>
Diffstat (limited to 'mm/percpu.c')
-rw-r--r--mm/percpu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/percpu.c b/mm/percpu.c
index cbace9e79f2d..fc1e8efb5222 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -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 */