Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751070AbbLDFnc (ORCPT ); Fri, 4 Dec 2015 00:43:32 -0500 Received: from mail-pf0-f169.google.com ([209.85.192.169]:34258 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750729AbbLDFnb (ORCPT ); Fri, 4 Dec 2015 00:43:31 -0500 X-Greylist: delayed 483 seconds by postgrey-1.27 at vger.kernel.org; Fri, 04 Dec 2015 00:43:30 EST Date: Fri, 4 Dec 2015 14:35:15 +0900 From: Minchan Kim To: Michal Hocko Cc: Andrew Morton , "Kirill A. Shutemov" , Johannes Weiner , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: memcg uncharge page counter mismatch Message-ID: <20151204053515.GA5174@blaptop> References: <20151201133455.GB27574@bbox> <20151202101643.GC25284@dhcp22.suse.cz> <20151203013404.GA30779@bbox> <20151203021006.GA31041@bbox> <20151203085451.GC9264@dhcp22.suse.cz> <20151203125950.GA1428@bbox> <20151203133719.GF9264@dhcp22.suse.cz> <20151203134326.GG9264@dhcp22.suse.cz> <20151203145850.GH9264@dhcp22.suse.cz> <20151203154729.GI9264@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151203154729.GI9264@dhcp22.suse.cz> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1761 Lines: 52 On Thu, Dec 03, 2015 at 04:47:29PM +0100, Michal Hocko wrote: > On Thu 03-12-15 15:58:50, Michal Hocko wrote: > [....] > > Warning, this looks ugly as hell. > > I was thinking about it some more and it seems that we should rather not > bother with partial thp at all and keep it in the original memcg > instead. It is way much less code and I do not think this will be too > disruptive. Somebody should be holding the thp head, right? > > Minchan, does this fix the issue you are seeing. This patch solves the issue but not sure it's right approach. I think it could make regression that in old, we could charge a THP page but we can't now. Whether it's trivial or not, it depends on memcg guys. Thanks. > --- > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 79a29d564bff..143c933f0b81 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -4895,6 +4895,14 @@ static int mem_cgroup_move_charge_pte_range(pmd_t *pmd, > switch (get_mctgt_type(vma, addr, ptent, &target)) { > case MC_TARGET_PAGE: > page = target.page; > + /* > + * We can have a part of the split pmd here. Moving it > + * can be done but it would be too convoluted so simply > + * ignore such a partial THP and keep it in original > + * memcg. There should be somebody mapping the head. > + */ > + if (PageCompound(page)) > + goto put; > if (isolate_lru_page(page)) > goto put; > if (!mem_cgroup_move_account(page, false, > -- > Michal Hocko > SUSE Labs -- Kind regards, Minchan Kim -- 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/