percpu: refactor the code in pcpu_[de]populate_chunk()
Using break statement at the end of a for loop is confusing, refactor it by replacing the for loop. Signed-off-by: WANG Cong <amwang@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
85438592f1
commit
22b737f4c7
1 changed files with 8 additions and 10 deletions
10
mm/percpu.c
10
mm/percpu.c
|
@ -886,11 +886,10 @@ static void pcpu_depopulate_chunk(struct pcpu_chunk *chunk, int off, int size)
|
||||||
int rs, re;
|
int rs, re;
|
||||||
|
|
||||||
/* quick path, check whether it's empty already */
|
/* quick path, check whether it's empty already */
|
||||||
pcpu_for_each_unpop_region(chunk, rs, re, page_start, page_end) {
|
rs = page_start;
|
||||||
|
pcpu_next_unpop(chunk, &rs, &re, page_end);
|
||||||
if (rs == page_start && re == page_end)
|
if (rs == page_start && re == page_end)
|
||||||
return;
|
return;
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* immutable chunks can't be depopulated */
|
/* immutable chunks can't be depopulated */
|
||||||
WARN_ON(chunk->immutable);
|
WARN_ON(chunk->immutable);
|
||||||
|
@ -941,11 +940,10 @@ static int pcpu_populate_chunk(struct pcpu_chunk *chunk, int off, int size)
|
||||||
int rs, re, rc;
|
int rs, re, rc;
|
||||||
|
|
||||||
/* quick path, check whether all pages are already there */
|
/* quick path, check whether all pages are already there */
|
||||||
pcpu_for_each_pop_region(chunk, rs, re, page_start, page_end) {
|
rs = page_start;
|
||||||
|
pcpu_next_pop(chunk, &rs, &re, page_end);
|
||||||
if (rs == page_start && re == page_end)
|
if (rs == page_start && re == page_end)
|
||||||
goto clear;
|
goto clear;
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* need to allocate and map pages, this chunk can't be immutable */
|
/* need to allocate and map pages, this chunk can't be immutable */
|
||||||
WARN_ON(chunk->immutable);
|
WARN_ON(chunk->immutable);
|
||||||
|
|
Reference in a new issue