Re: [RFC][PATCH 1/4] memcg: fix formem_cgroup_get_reclaim_stat_from_page

From: KAMEZAWA Hiroyuki
Date: Thu Jan 08 2009 - 05:59:36 EST


Daisuke Nishimura said:

> Call Trace:
> [<ffffffff8028ea17>] ? ____pagevec_lru_add+0xc1/0x13c
> [<ffffffff8028ec34>] ? drain_cpu_pagevecs+0x36/0x89
> [<ffffffff802a4f8c>] ? swapin_readahead+0x78/0x98
> [<ffffffff8029a37a>] ? handle_mm_fault+0x3d9/0x741
> [<ffffffff804da654>] ? do_page_fault+0x3ce/0x78c
> [<ffffffff804d7a42>] ? trace_hardirqs_off_thunk+0x3a/0x3c
> [<ffffffff804d860f>] ? page_fault+0x1f/0x30
> Code: cc 55 48 8d af b8 0d 00 00 48 89 f7 53 89 d3 e8 39 85 02 00 48
> 63 d3 48 ff 44 d5 10 45 85 e4 74 05 48 ff 44 d5 00 48 85 c0 74 0e <48>
> ff 44 d0 10 45 85 e4 74 04 48 ff 04 d0 5b 5d 41 5c c3 41 54
> RIP [<ffffffff8028e710>] update_page_reclaim_stat+0x2f/0x42
> RSP <ffff8801ee457da8>
>
>
> Signed-off-by: Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx>
yes. PageCgroupUsed() should be cheked.
or
list_empty(&pc->lru) should be checked under zone->lock.
Your fix seems reasonable.

Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>

> ---
> mm/memcontrol.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index e2996b8..62e69d8 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -559,6 +559,10 @@ mem_cgroup_get_reclaim_stat_from_page(struct page
> *page)
> return NULL;
>
> pc = lookup_page_cgroup(page);
> + smp_rmb();
> + if (!PageCgroupUsed(pc))
> + return NULL;
> +
> mz = page_cgroup_zoneinfo(pc);
> if (!mz)
> return NULL;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/