Commit 21ddfd38 authored by Jianyu Zhan's avatar Jianyu Zhan Committed by Tejun Heo

percpu: renew the max_contig if we merge the head and previous block

During pcpu_alloc_area(), we might merge the current head with the
previous block. Since we have calculated the max_contig using the
size of previous block before we skip it, and now we update the size
of previous block, so we should renew the max_contig.
Signed-off-by: default avatarJianyu Zhan <nasa4836@gmail.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 2f69fa82
...@@ -473,9 +473,11 @@ static int pcpu_alloc_area(struct pcpu_chunk *chunk, int size, int align) ...@@ -473,9 +473,11 @@ static int pcpu_alloc_area(struct pcpu_chunk *chunk, int size, int align)
* uncommon for percpu allocations. * uncommon for percpu allocations.
*/ */
if (head && (head < sizeof(int) || !(p[-1] & 1))) { if (head && (head < sizeof(int) || !(p[-1] & 1))) {
*p = off += head;
if (p[-1] & 1) if (p[-1] & 1)
chunk->free_size -= head; chunk->free_size -= head;
*p = off += head; else
max_contig = max(*p - p[-1], max_contig);
this_size -= head; this_size -= head;
head = 0; head = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment