diff options
author | 2009-01-07 18:08:18 -0800 | |
---|---|---|
committer | 2009-01-08 08:31:07 -0800 | |
commit | 549927620b04a8f8073ce2ee2a8977f209af2ee5 (patch) | |
tree | 6451507892fb353732fe959b2bf0a171fa3ac20b /mm | |
parent | mm: make get_scan_ratio() safe for memcg (diff) | |
download | linux-549927620b04a8f8073ce2ee2a8977f209af2ee5.tar.gz linux-549927620b04a8f8073ce2ee2a8977f209af2ee5.tar.bz2 linux-549927620b04a8f8073ce2ee2a8977f209af2ee5.zip |
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>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memcontrol.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 9b4993ee46b3..457d671029b8 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -231,6 +231,9 @@ page_cgroup_zoneinfo(struct page_cgroup *pc) int nid = page_cgroup_nid(pc); int zid = page_cgroup_zid(pc); + if (!mem) + return NULL; + return mem_cgroup_zoneinfo(mem, nid, zid); } |