mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 14:43:16 +00:00
memcg: add null check to page_cgroup_zoneinfo()
If CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y, page_cgroup::mem_cgroup can be NULL. Therefore null checking is better. A later patch uses this function. Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Rik van Riel <riel@redhat.com> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Balbir Singh <balbir@in.ibm.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Cc: Hugh Dickins <hugh@veritas.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
eeee9a8cd1
commit
549927620b
@ -231,6 +231,9 @@ page_cgroup_zoneinfo(struct page_cgroup *pc)
|
|||||||
int nid = page_cgroup_nid(pc);
|
int nid = page_cgroup_nid(pc);
|
||||||
int zid = page_cgroup_zid(pc);
|
int zid = page_cgroup_zid(pc);
|
||||||
|
|
||||||
|
if (!mem)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return mem_cgroup_zoneinfo(mem, nid, zid);
|
return mem_cgroup_zoneinfo(mem, nid, zid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user