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=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL 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 83597C388F2 for ; Tue, 20 Oct 2020 16:57:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E848622242 for ; Tue, 20 Oct 2020 16:57:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GlmFnKSu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E848622242 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 63C766B006E; Tue, 20 Oct 2020 12:57:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EC666B0071; Tue, 20 Oct 2020 12:57:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 502806B0072; Tue, 20 Oct 2020 12:57:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0169.hostedemail.com [216.40.44.169]) by kanga.kvack.org (Postfix) with ESMTP id 237726B006E for ; Tue, 20 Oct 2020 12:57:05 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9E00D180AD815 for ; Tue, 20 Oct 2020 16:57:04 +0000 (UTC) X-FDA: 77392908768.23.wrist45_5d0242027241 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 7365637606 for ; Tue, 20 Oct 2020 16:57:04 +0000 (UTC) X-HE-Tag: wrist45_5d0242027241 X-Filterd-Recvd-Size: 4390 Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Tue, 20 Oct 2020 16:57:03 +0000 (UTC) Received: by mail-lj1-f193.google.com with SMTP id a4so2766213lji.12 for ; Tue, 20 Oct 2020 09:57:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Bq8GoxVyo7gYf7b14RQXOf1f0F80lNlq4H2QZVhqpxs=; b=GlmFnKSun8DV43nTlPdV+XO2Gf5tvurJdBjQjMLyLJc7GzalEIG6ugrLcrOYrvLNVL eI5ABURDeNtLlU9DzOsIDes1PDJPHBqJqWO4J/+b/mL4oAoA+ps0nCFliPaCVagdn0VK VeVW0OmGjSuAT3AUYEc6lveH9NPknQ95fx20WayIvbHHE/D6wCDfBmlEWHhgEPV7xBDW qCnqbqc3SlT6jIC261l88VcYxFYzPZTvSFKbRdW0lURyl9ADY2a2SGJkmDeiJKXhmpRn IxqCFW+Z225MyB+sKga38zg1TqgidiuYm0cfcCRV1K7LJqct8Rp5DhUNHjWFF8SRldiK 1+Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Bq8GoxVyo7gYf7b14RQXOf1f0F80lNlq4H2QZVhqpxs=; b=G7Awgwo7hlXJX5HdOt3J3HPbnlIqoaf3UPgNoawDogU5b5dmrM3DTsAPbU5sxWdAso xQLPzCO+LcKSLZjbnHwlu5/utUgXv/lxYsTno4ISRScJQflH+hN+9KRbQpA5T7PRlR4N ZcL/7Zo2yJ1fg1j+eRLaWoNf5q4IFnO9pP37s8+fO62e6podYyLeKewPrQnyLIgnSNrA Adve3YG2+pD81DuHyiLTv3Z3zsDOf1Ou/H6NXW+6UYbZWWfFGBb04r47PYLkKM3WxdSK HiTKV4yrq3ukOMFOd7VDK8PMQIC58133MyECGs1vMMG0RVJxs3t39Dyv5urCVkfxvwez iZNg== X-Gm-Message-State: AOAM530Rv3Y0hme2JWco20HdkVjzcQt1JWQz+RIbp1mQtQn/9yK7noJ1 fsyPpKgWZJ0p4pQjOD9CXMJsJVvlyjZPOgJlOtsuaA== X-Google-Smtp-Source: ABdhPJyP/DA7JLtU7l6FFKLqDzXFS9L6C8jNSI7xsOJZaUVquq/DPfMLt8k9HTf5vT6Xt1piKgc+oG8QTp5H3VgE7F4= X-Received: by 2002:a2e:91c8:: with SMTP id u8mr1475971ljg.192.1603213022378; Tue, 20 Oct 2020 09:57:02 -0700 (PDT) MIME-Version: 1.0 References: <87lfg2ob83.fsf@suse.de> <20201019095812.25710-1-rpalethorpe@suse.com> <87mu0hwik7.fsf@suse.de> <87eeltvwg4.fsf@suse.de> In-Reply-To: <87eeltvwg4.fsf@suse.de> From: Shakeel Butt Date: Tue, 20 Oct 2020 09:56:51 -0700 Message-ID: Subject: Re: [PATCH v3] mm: memcg/slab: Stop reparented obj_cgroups from charging root To: rpalethorpe@suse.de Cc: Linux MM , LKML , LTP List , Roman Gushchin , Johannes Weiner , Andrew Morton , Christoph Lameter , Michal Hocko , Tejun Heo , Vlastimil Babka Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000075, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Oct 20, 2020 at 6:49 AM Richard Palethorpe wrote: > > Hello, > > Richard Palethorpe writes: > > > Hello Shakeel, > > > > Shakeel Butt writes: > >>> > >>> V3: Handle common case where use_hierarchy=1 and update description. > >>> > >>> mm/memcontrol.c | 7 +++++-- > >>> 1 file changed, 5 insertions(+), 2 deletions(-) > >>> > >>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c > >>> index 6877c765b8d0..34b8c4a66853 100644 > >>> --- a/mm/memcontrol.c > >>> +++ b/mm/memcontrol.c > >>> @@ -291,7 +291,7 @@ static void obj_cgroup_release(struct percpu_ref *ref) > >>> > >>> spin_lock_irqsave(&css_set_lock, flags); > >>> memcg = obj_cgroup_memcg(objcg); > >>> - if (nr_pages) > >>> + if (nr_pages && (!mem_cgroup_is_root(memcg) || memcg->use_hierarchy)) > >> > >> If we have non-root memcg with use_hierarchy as 0 and this objcg was > >> reparented then this __memcg_kmem_uncharge() can potentially underflow > >> the page counter and give the same warning. > > > > Yes, although the kernel considers such a config to be broken, and > > prints a warning to the log, it does allow it. > > Actually this can not happen because if use_hierarchy=0 then the objcg > will be reparented to root. > Yup, you are right. I do wonder if we should completely deprecate use_hierarchy=0.