diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2015-02-11 18:26:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-11 20:06:03 -0500 |
commit | 9c608dbe6a0d137f78498a5181eb0cd309f8f067 (patch) | |
tree | e0b2108f4be39dfd81a6376b405e0d0d5fbf3a3f /mm/memcontrol.c | |
parent | 94737a85f332aee75255960eaa16e89ddfa4c75a (diff) |
mm: memcontrol: simplify soft limit tree init code
- No need to test the node for N_MEMORY. node_online() is enough for
node fallback to work in slab, use NUMA_NO_NODE for everything else.
- Remove the BUG_ON() for allocation failure. A NULL pointer crash is
just as descriptive, and the absent return value check is obvious.
- Move local variables to the inner-most blocks.
- Point to the tree structure after its initialized, not before, it's
just more logical that way.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Vladimir Davydov <vdavydov@parallels.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index fbf64e6f64e4..2efec685793b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -4509,24 +4509,23 @@ EXPORT_SYMBOL(parent_mem_cgroup); | |||
4509 | 4509 | ||
4510 | static void __init mem_cgroup_soft_limit_tree_init(void) | 4510 | static void __init mem_cgroup_soft_limit_tree_init(void) |
4511 | { | 4511 | { |
4512 | struct mem_cgroup_tree_per_node *rtpn; | 4512 | int node; |
4513 | struct mem_cgroup_tree_per_zone *rtpz; | ||
4514 | int tmp, node, zone; | ||
4515 | 4513 | ||
4516 | for_each_node(node) { | 4514 | for_each_node(node) { |
4517 | tmp = node; | 4515 | struct mem_cgroup_tree_per_node *rtpn; |
4518 | if (!node_state(node, N_NORMAL_MEMORY)) | 4516 | int zone; |
4519 | tmp = -1; | ||
4520 | rtpn = kzalloc_node(sizeof(*rtpn), GFP_KERNEL, tmp); | ||
4521 | BUG_ON(!rtpn); | ||
4522 | 4517 | ||
4523 | soft_limit_tree.rb_tree_per_node[node] = rtpn; | 4518 | rtpn = kzalloc_node(sizeof(*rtpn), GFP_KERNEL, |
4519 | node_online(node) ? node : NUMA_NO_NODE); | ||
4524 | 4520 | ||
4525 | for (zone = 0; zone < MAX_NR_ZONES; zone++) { | 4521 | for (zone = 0; zone < MAX_NR_ZONES; zone++) { |
4522 | struct mem_cgroup_tree_per_zone *rtpz; | ||
4523 | |||
4526 | rtpz = &rtpn->rb_tree_per_zone[zone]; | 4524 | rtpz = &rtpn->rb_tree_per_zone[zone]; |
4527 | rtpz->rb_root = RB_ROOT; | 4525 | rtpz->rb_root = RB_ROOT; |
4528 | spin_lock_init(&rtpz->lock); | 4526 | spin_lock_init(&rtpz->lock); |
4529 | } | 4527 | } |
4528 | soft_limit_tree.rb_tree_per_node[node] = rtpn; | ||
4530 | } | 4529 | } |
4531 | } | 4530 | } |
4532 | 4531 | ||