Commit 54f72fe022d9b2c4de40043a118881121190a117

Authored by Johannes Weiner
Committed by Linus Torvalds
1 parent 9a2458a633

memcg: clean up memcg->nodeinfo

Remove struct mem_cgroup_lru_info and fold its single member, the
variably sized nodeinfo[0], directly into struct mem_cgroup.  This
should make it more obvious why it has to be the last member there.

Also move the comment that's above that special last member below it, so
it is more visible to somebody that considers appending to the struct
mem_cgroup.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: David Rientjes <rientjes@google.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Glauber Costa <glommer@openvz.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 5 additions and 15 deletions Side-by-side Diff

... ... @@ -187,10 +187,6 @@
187 187 struct mem_cgroup_per_zone zoneinfo[MAX_NR_ZONES];
188 188 };
189 189  
190   -struct mem_cgroup_lru_info {
191   - struct mem_cgroup_per_node *nodeinfo[0];
192   -};
193   -
194 190 /*
195 191 * Cgroups above their limits are maintained in a RB-Tree, independent of
196 192 * their hierarchy representation
... ... @@ -366,14 +362,8 @@
366 362 atomic_t numainfo_updating;
367 363 #endif
368 364  
369   - /*
370   - * Per cgroup active and inactive list, similar to the
371   - * per zone LRU lists.
372   - *
373   - * WARNING: This has to be the last element of the struct. Don't
374   - * add new fields after this point.
375   - */
376   - struct mem_cgroup_lru_info info;
  365 + struct mem_cgroup_per_node *nodeinfo[0];
  366 + /* WARNING: nodeinfo must be the last member here */
377 367 };
378 368  
379 369 static size_t memcg_size(void)
... ... @@ -683,7 +673,7 @@
683 673 mem_cgroup_zoneinfo(struct mem_cgroup *memcg, int nid, int zid)
684 674 {
685 675 VM_BUG_ON((unsigned)nid >= nr_node_ids);
686   - return &memcg->info.nodeinfo[nid]->zoneinfo[zid];
  676 + return &memcg->nodeinfo[nid]->zoneinfo[zid];
687 677 }
688 678  
689 679 struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg)
690 680  
... ... @@ -6087,13 +6077,13 @@
6087 6077 mz->on_tree = false;
6088 6078 mz->memcg = memcg;
6089 6079 }
6090   - memcg->info.nodeinfo[node] = pn;
  6080 + memcg->nodeinfo[node] = pn;
6091 6081 return 0;
6092 6082 }
6093 6083  
6094 6084 static void free_mem_cgroup_per_zone_info(struct mem_cgroup *memcg, int node)
6095 6085 {
6096   - kfree(memcg->info.nodeinfo[node]);
  6086 + kfree(memcg->nodeinfo[node]);
6097 6087 }
6098 6088  
6099 6089 static struct mem_cgroup *mem_cgroup_alloc(void)