Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754431Ab0DNBoK (ORCPT ); Tue, 13 Apr 2010 21:44:10 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:51973 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754367Ab0DNBoG (ORCPT ); Tue, 13 Apr 2010 21:44:06 -0400 X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Date: Wed, 14 Apr 2010 10:40:10 +0900 From: KAMEZAWA Hiroyuki To: KAMEZAWA Hiroyuki Cc: Daisuke Nishimura , LKML , linux-mm , Mel Gorman , Rik van Riel , Minchan Kim , Balbir Singh , KOSAKI Motohiro , Christoph Lameter , Andrea Arcangeli , Andrew Morton Subject: Re: [RFC][BUGFIX][PATCH] memcg: fix underflow of mapped_file stat Message-Id: <20100414104010.7a359d04.kamezawa.hiroyu@jp.fujitsu.com> In-Reply-To: <20100414100308.693c5650.kamezawa.hiroyu@jp.fujitsu.com> References: <20100413134207.f12cdc9c.nishimura@mxp.nes.nec.co.jp> <20100413151400.cb89beb7.kamezawa.hiroyu@jp.fujitsu.com> <20100414095408.d7b352f1.nishimura@mxp.nes.nec.co.jp> <20100414100308.693c5650.kamezawa.hiroyu@jp.fujitsu.com> Organization: FUJITSU Co. LTD. X-Mailer: Sylpheed 3.0.2 (GTK+ 2.10.14; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1371 Lines: 37 On Wed, 14 Apr 2010 10:03:08 +0900 KAMEZAWA Hiroyuki wrote: > > > @@ -2563,6 +2565,15 @@ void mem_cgroup_end_migration(struct mem > > > */ > > > if (ctype == MEM_CGROUP_CHARGE_TYPE_MAPPED) > > > mem_cgroup_uncharge_page(target); > > > + else { > > > + /* > > > + * When a migrated file cache is remapped, it's not charged. > > > + * Verify it. Because we're under lock_page(), there are > > > + * no race with uncharge. > > > + */ > > > + if (page_mapped(target)) > > > + mem_cgroup_update_file_mapped(mem, target, 1); > > > + } > > We cannot rely on page lock, because when we succeeded in page migration, > > "target" = "newpage" has already unlocked in move_to_new_page(). So the "target" > > can be removed from the radix-tree theoretically(it's not related to this > > underflow problem, though). > > Shouldn't we call lock_page(target) and check "if (!target->mapping)" to handle > > this case(maybe in another patch) ? > > > Sounds reasonable. I think about that. > Ah, PageCgroupUsed() is already checked under lock_page_cgroup(). It's enough. Thanks, -Kame -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/