提交 c7458ae8 编写于 作者: L Liu Shixin 提交者: Yang Yingliang

mm: memcontrol: add struct mem_cgroup_extension

hulk inclusion
category: bugfix
bugzilla: 47240
CVE: NA

-------------------------------------------------

Change struct mem_cgroup directly will causes the kabi broken.
So add a new struct mem_cgroup_extension for new variables.
Signed-off-by: NLiu Shixin <liushixin2@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 abbe9a8f
...@@ -318,6 +318,10 @@ struct mem_cgroup { ...@@ -318,6 +318,10 @@ struct mem_cgroup {
/* WARNING: nodeinfo must be the last member here */ /* WARNING: nodeinfo must be the last member here */
}; };
struct mem_cgroup_extension {
struct mem_cgroup memcg;
};
/* /*
* size of first charge trial. "32" comes from vmscan.c's magic value. * size of first charge trial. "32" comes from vmscan.c's magic value.
* TODO: maybe necessary to use big numbers in big irons. * TODO: maybe necessary to use big numbers in big irons.
......
...@@ -4508,11 +4508,14 @@ static void free_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node) ...@@ -4508,11 +4508,14 @@ static void free_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node)
static void __mem_cgroup_free(struct mem_cgroup *memcg) static void __mem_cgroup_free(struct mem_cgroup *memcg)
{ {
int node; int node;
struct mem_cgroup_extension *memcg_ext;
for_each_node(node) for_each_node(node)
free_mem_cgroup_per_node_info(memcg, node); free_mem_cgroup_per_node_info(memcg, node);
free_percpu(memcg->stat_cpu); free_percpu(memcg->stat_cpu);
kfree(memcg);
memcg_ext = container_of(memcg, struct mem_cgroup_extension, memcg);
kfree(memcg_ext);
} }
static void mem_cgroup_free(struct mem_cgroup *memcg) static void mem_cgroup_free(struct mem_cgroup *memcg)
...@@ -4524,13 +4527,15 @@ static void mem_cgroup_free(struct mem_cgroup *memcg) ...@@ -4524,13 +4527,15 @@ static void mem_cgroup_free(struct mem_cgroup *memcg)
static struct mem_cgroup *mem_cgroup_alloc(void) static struct mem_cgroup *mem_cgroup_alloc(void)
{ {
struct mem_cgroup *memcg; struct mem_cgroup *memcg;
struct mem_cgroup_extension *memcg_ext;
size_t size; size_t size;
int node; int node;
size = sizeof(struct mem_cgroup); size = sizeof(struct mem_cgroup_extension);
size += nr_node_ids * sizeof(struct mem_cgroup_per_node *); size += nr_node_ids * sizeof(struct mem_cgroup_per_node *);
memcg = kzalloc(size, GFP_KERNEL); memcg_ext = kzalloc(size, GFP_KERNEL);
memcg = &memcg_ext->memcg;
if (!memcg) if (!memcg)
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册