Skip to content

Commit

Permalink
percpu: renew the max_contig if we merge the head and previous block
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
  • Loading branch information
JianyuZhan authored and htejun committed Mar 29, 2014
1 parent 2f69fa8 commit 21ddfd3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mm/percpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 21ddfd3

Please sign in to comment.