Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1181100pxu; Fri, 16 Oct 2020 06:04:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4Of5Hk/R6yORpckBAZeTdTqt2Uuya5We2ngg4yIPVti6U1BXvdtM+BxdFV6S/srSCX4ps X-Received: by 2002:a17:906:935a:: with SMTP id p26mr3545003ejw.30.1602853464206; Fri, 16 Oct 2020 06:04:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602853464; cv=none; d=google.com; s=arc-20160816; b=0zVUxfQ9ePCsk9c9cxkn/cSQ2vqm2IKlXm0EGOWtvd5fWnPNe7+wwtEZld2gav9UQG 0We9SEOUrI9nvMN8/PJf35UuYX1fie3ggqy5r9bB1HhH+gPp7W8rZIZraSsjHUoJVkeI jRmcFyVLPWzR87Z+iVYnpJJNY+24I67c5ESSMbPGn/RjFUYrTez0GK+a6/u6303omps5 mwRSo7RLP0zMPWHhgFrFErgHx5fhxgF0ALxSWgcrCKOp1DkyHy8/wL9typr80XD4SD5x wrkbs47gontmB5Juy8CaXMNh1vzO71QsHadJ2w1PjtySGovpaN/PVwvPRgJ21HDqAVxw L9Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:in-reply-to:reply-to:subject:cc:to:from:user-agent :references; bh=9pwL1zjczZLz6VgJoya7tyLnSXQZRtdd3z0OwxK3o0U=; b=ONcHE9V9SASqILPWVrBbhr45Ut/1KwTt2P44v1a3ltZl7ACGdo2bQGE+Nyr9JIeNOX akmOH9h5EUS2XqFvRq9HJgvsh/l/al4hypFYilaUnkauX99R0J3Evp8j/xwTZ8mAer1A YXP0ytv97bBhTqefD9xKxEQyIizi5LJvdFUSL69u6U/4ZjN/SLxx7zLxwywtZ4a3lNMP yFxYkdbfLACa2NFBDkA4NQ1ZRc0pQoI9bAqm1SHZkPi+8lAYwJBO+jwFvSB8KbYDT2LC Lx0lpXQkj4M432GQhFIih/qerUo8OCfhzskOCFxCbGf6w+3leqZuCLU6Cgs5SF7qcxqj y4nA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si1631093ejj.86.2020.10.16.06.03.46; Fri, 16 Oct 2020 06:04:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395459AbgJPKlq convert rfc822-to-8bit (ORCPT + 99 others); Fri, 16 Oct 2020 06:41:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:50850 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395455AbgJPKlq (ORCPT ); Fri, 16 Oct 2020 06:41:46 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1DCC7AB5C; Fri, 16 Oct 2020 10:41:45 +0000 (UTC) References: <20201014190749.24607-1-rpalethorpe@suse.com> <20201016094702.GA95052@blackbook> User-agent: mu4e 1.4.13; emacs 27.1 From: Richard Palethorpe To: Michal =?utf-8?Q?Koutn=C3=BD?= Cc: Roman Gushchin , ltp@lists.linux.it, Johannes Weiner , Andrew Morton , Shakeel Butt , Christoph Lameter , Michal Hocko , Tejun Heo , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] mm: memcg/slab: Stop reparented obj_cgroups from charging root Reply-To: rpalethorpe@suse.de In-reply-to: <20201016094702.GA95052@blackbook> Date: Fri, 16 Oct 2020 11:41:43 +0100 Message-ID: <87sgaesba0.fsf@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Michal, Michal Koutný writes: > Hello. > > On Wed, Oct 14, 2020 at 08:07:49PM +0100, Richard Palethorpe wrote: >> SLAB objects which outlive their memcg are moved to their parent >> memcg where they may be uncharged. However if they are moved to the >> root memcg, uncharging will result in negative page counter values as >> root has no page counters. > Why do you think those are reparented objects? If those are originally > charged in a non-root cgroup, then the charge value should be propagated up the > hierarchy, including root memcg, so if they're later uncharged in root > after reparenting, it should still break even. (Or did I miss some stock > imbalance?) I traced it and can see they are reparented objects and that the root groups counters are zero (or negative if I run madvise06 multiple times) before a drain takes place. I'm guessing this is because the root group has 'use_hierachy' set to false so that the childs page_counter parents are set to NULL. However I will check, because I'm not sure about either. > > (But the patch seems justifiable to me as objects (not)charged directly to > root memcg may be incorrectly uncharged.) > > Thanks, > Michal -- Thank you, Richard.