From: Jianyu Zhan Date: Fri, 28 Mar 2014 12:55:21 +0000 (+0800) Subject: percpu: renew the max_contig if we merge the head and previous block X-Git-Tag: MMI-PSA29.97-13-9~12524^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=21ddfd38ee9aac804d22beaceed4c7b903cca234;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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: Jianyu Zhan Signed-off-by: Tejun Heo --- diff --git a/mm/percpu.c b/mm/percpu.c index 202e104df8a7..63e24fb4387b 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -473,9 +473,11 @@ static int pcpu_alloc_area(struct pcpu_chunk *chunk, int size, int align) * uncommon for percpu allocations. */ if (head && (head < sizeof(int) || !(p[-1] & 1))) { + *p = off += head; if (p[-1] & 1) chunk->free_size -= head; - *p = off += head; + else + max_contig = max(*p - p[-1], max_contig); this_size -= head; head = 0; }