提交 e04d3208 编写于 作者: T Tejun Heo

percpu: indent the population block in pcpu_alloc()

The next patch will conditionalize the population block in
pcpu_alloc() which will end up making a rather large indentation
change obfuscating the actual logic change.  This patch puts the block
under "if (true)" so that the next patch can avoid indentation
changes.  The defintions of the local variables which are used only in
the block are moved into the block.

This patch is purely cosmetic.
Signed-off-by: NTejun Heo <tj@kernel.org>
上级 a16037c8
...@@ -742,7 +742,6 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved) ...@@ -742,7 +742,6 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved)
struct pcpu_chunk *chunk; struct pcpu_chunk *chunk;
const char *err; const char *err;
int slot, off, new_alloc, cpu, ret; int slot, off, new_alloc, cpu, ret;
int page_start, page_end, rs, re;
unsigned long flags; unsigned long flags;
void __percpu *ptr; void __percpu *ptr;
...@@ -847,27 +846,32 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved) ...@@ -847,27 +846,32 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved)
spin_unlock_irqrestore(&pcpu_lock, flags); spin_unlock_irqrestore(&pcpu_lock, flags);
/* populate if not all pages are already there */ /* populate if not all pages are already there */
mutex_lock(&pcpu_alloc_mutex); if (true) {
page_start = PFN_DOWN(off); int page_start, page_end, rs, re;
page_end = PFN_UP(off + size);
pcpu_for_each_unpop_region(chunk, rs, re, page_start, page_end) { mutex_lock(&pcpu_alloc_mutex);
WARN_ON(chunk->immutable);
ret = pcpu_populate_chunk(chunk, rs, re); page_start = PFN_DOWN(off);
page_end = PFN_UP(off + size);
spin_lock_irqsave(&pcpu_lock, flags); pcpu_for_each_unpop_region(chunk, rs, re, page_start, page_end) {
if (ret) { WARN_ON(chunk->immutable);
mutex_unlock(&pcpu_alloc_mutex);
pcpu_free_area(chunk, off); ret = pcpu_populate_chunk(chunk, rs, re);
err = "failed to populate";
goto fail_unlock; spin_lock_irqsave(&pcpu_lock, flags);
if (ret) {
mutex_unlock(&pcpu_alloc_mutex);
pcpu_free_area(chunk, off);
err = "failed to populate";
goto fail_unlock;
}
bitmap_set(chunk->populated, rs, re - rs);
spin_unlock_irqrestore(&pcpu_lock, flags);
} }
bitmap_set(chunk->populated, rs, re - rs);
spin_unlock_irqrestore(&pcpu_lock, flags);
}
mutex_unlock(&pcpu_alloc_mutex); mutex_unlock(&pcpu_alloc_mutex);
}
/* clear the areas and return address relative to base address */ /* clear the areas and return address relative to base address */
for_each_possible_cpu(cpu) for_each_possible_cpu(cpu)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册