From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64E9BC43457 for ; Fri, 16 Oct 2020 15:05:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D391F20866 for ; Fri, 16 Oct 2020 15:05:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D391F20866 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EE4FB900002; Fri, 16 Oct 2020 11:05:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB8E66B0062; Fri, 16 Oct 2020 11:05:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DCE8A900002; Fri, 16 Oct 2020 11:05:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0249.hostedemail.com [216.40.44.249]) by kanga.kvack.org (Postfix) with ESMTP id 5B0466B005C for ; Fri, 16 Oct 2020 11:05:25 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 539918249980 for ; Fri, 16 Oct 2020 15:05:24 +0000 (UTC) X-FDA: 77378112168.16.knife34_3f08a1a2721e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 1AC2C101DB62E for ; Fri, 16 Oct 2020 15:05:24 +0000 (UTC) X-HE-Tag: knife34_3f08a1a2721e X-Filterd-Recvd-Size: 3173 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Fri, 16 Oct 2020 15:05:23 +0000 (UTC) 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 594B3B1AB; Fri, 16 Oct 2020 15:05:22 +0000 (UTC) References: <20201014190749.24607-1-rpalethorpe@suse.com> <20201016094702.GA95052@blackbook> <87sgaesba0.fsf@suse.de> 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: <87sgaesba0.fsf@suse.de> Date: Fri, 16 Oct 2020 16:05:21 +0100 Message-ID: <87pn5irz2m.fsf@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hello, Richard Palethorpe writes: > Hello Michal, > > Michal Koutn=C3=BD 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. Yes, it appears that use_hierarchy=3D0 which is probably because the test mounts cgroup v1, creates a child group within that and does not set use_hierarchy on the root. On v2 root always has use_hierarchy enabled. > >> >> (But the patch seems justifiable to me as objects (not)charged directly = to >> root memcg may be incorrectly uncharged.) >> >> Thanks, >> Michal I'm don't know if that could happen without reparenting. I suppose if use_hierarchy=3D1 then actually this patch will result in root being overcharged, so perhaps it should also check for use_hierarchy? --=20 Thank you, Richard.