summaryrefslogtreecommitdiffstats
path: root/mm/percpu.c
diff options
context:
space:
mode:
authorJianyu Zhan <nasa4836@gmail.com>2014-03-28 13:55:21 +0100
committerTejun Heo <tj@kernel.org>2014-03-29 14:29:42 +0100
commit21ddfd38ee9aac804d22beaceed4c7b903cca234 (patch)
treea4d853bdc3b274be013aa97d6378acbf2f995d88 /mm/percpu.c
parentpercpu: allocation size should be even (diff)
downloadlinux-21ddfd38ee9aac804d22beaceed4c7b903cca234.tar.xz
linux-21ddfd38ee9aac804d22beaceed4c7b903cca234.zip
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 <nasa4836@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'mm/percpu.c')
-rw-r--r--mm/percpu.c4
1 files changed, 3 insertions, 1 deletions
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;
}