]> git.baikalelectronics.ru Git - kernel.git/commit
percpu: fix iteration to prevent skipping over block
authorDennis Zhou <dennisszhou@gmail.com>
Wed, 27 Sep 2017 21:35:00 +0000 (16:35 -0500)
committerTejun Heo <tj@kernel.org>
Thu, 28 Sep 2017 14:39:27 +0000 (07:39 -0700)
commit59000ef5662ba1734ed71ad7d7dbf3038c738cf6
tree8b2212d5142ff1e0c12a5de1955ccff194132126
parent00194e3330da6f709a2516b71aea9b56bb081886
percpu: fix iteration to prevent skipping over block

The iterator functions pcpu_next_md_free_region and
pcpu_next_fit_region use the block offset to determine if they have
checked the area in the prior iteration. However, this causes an issue
when the block offset is greater than subsequent block contig hints. If
within the iterator it moves to check subsequent blocks, it may fail in
the second predicate due to the block offset not being cleared. Thus,
this causes the allocator to skip over blocks leading to false failures
when allocating from the reserved chunk. While this happens in the
general case as well, it will only fail if it cannot allocate a new
chunk.

This patch resets the block offset to 0 to pass the second predicate
when checking subseqent blocks within the iterator function.

Signed-off-by: Dennis Zhou <dennisszhou@gmail.com>
Reported-and-tested-by: Luis Henriques <lhenriques@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
mm/percpu.c