diff options
author | WANG Cong <amwang@redhat.com> | 2009-12-01 23:28:10 +0900 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-12-08 10:28:54 +0900 |
commit | 22b737f4c75197372d64afc6ed1bccd58c00e549 (patch) | |
tree | 18c03657715f8e66a8261bf8422b0105001c8eb9 /mm/percpu.c | |
parent | 85438592f179c126ad4cb9a280046d4f0a501e6d (diff) | |
download | talos-op-linux-22b737f4c75197372d64afc6ed1bccd58c00e549.tar.gz talos-op-linux-22b737f4c75197372d64afc6ed1bccd58c00e549.zip |
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>
Diffstat (limited to 'mm/percpu.c')
-rw-r--r-- | mm/percpu.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/mm/percpu.c b/mm/percpu.c index e2e80fc78601..77c6f7994a46 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -886,11 +886,10 @@ static void pcpu_depopulate_chunk(struct pcpu_chunk *chunk, int off, int size) int rs, re; /* quick path, check whether it's empty already */ - pcpu_for_each_unpop_region(chunk, rs, re, page_start, page_end) { - if (rs == page_start && re == page_end) - return; - break; - } + rs = page_start; + pcpu_next_unpop(chunk, &rs, &re, page_end); + if (rs == page_start && re == page_end) + return; /* immutable chunks can't be depopulated */ 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; /* quick path, check whether all pages are already there */ - pcpu_for_each_pop_region(chunk, rs, re, page_start, page_end) { - if (rs == page_start && re == page_end) - goto clear; - break; - } + rs = page_start; + pcpu_next_pop(chunk, &rs, &re, page_end); + if (rs == page_start && re == page_end) + goto clear; /* need to allocate and map pages, this chunk can't be immutable */ WARN_ON(chunk->immutable); |