Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4663601pxu; Wed, 21 Oct 2020 01:59:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxV2fGsByucPgciu89e3gERDwh5StcJtbRNQqdNWBy2sgab0b4D+RDNR+HSI4+TNyrB9MIg X-Received: by 2002:a50:fa89:: with SMTP id w9mr2008364edr.235.1603270784258; Wed, 21 Oct 2020 01:59:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603270784; cv=none; d=google.com; s=arc-20160816; b=tLlSIDzPkkCt4cQ07hu7ovd03sTPVy3ulhaX/fRApwM5a74tE34mzka/Qqo8CkEWQH 7wCj5MNGLAouDYMQlBj8bDv3eJVxy1Woc+QK6ifIyOaO9jbLTNyBs6IYOZkHf3/DdIxm adLyblmyY6qsSVsilsEZDBM0yQzLYBvxZAB5/Gtvr/AjXGk1BkGvXPOQmFhTFu12t50w xRqp30mkaWdDiovThGaksQr7yjZF3KKW4euluQ3O67AQ20G3WTpQRlodBOW7hXruOkAr sb6+Evd539ITSxJZkj+H8KftPefJXjhDbs24reRKpp3kQH9H88D6XSTF8U2u04j0sZi7 O4FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Bq8GoxVyo7gYf7b14RQXOf1f0F80lNlq4H2QZVhqpxs=; b=SdDf/6ZdUiyOOm9kHa8zKRB+xR07B4RMx3B/NqNYyweuybJEH0RYUnh9p0PIJpPkHS Ja+ESl2z4kcLLFcPutu2qr8boukNG4gzh/jHztzruyR4KdQp4BbzuF+kjbqdikJR7FUJ RFIQmGszAsFitl5x23uwfliqWbONBRqzsvdP1vqapcM0BbwKJPT6peAnG40usua5owjn WtmDm+xXrJ4he6fDiAoFDcxNJ0PW1aftiNxecKmDdkPERO/s5mdDvfXwepqJWkGwjmen 6Kia6iFq4spmpC1z7kwLUSdwCsEYG6n30wTUQoinR54mVzrk8fU6mTwxgStn5dD7uHAY Vi7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=GlmFnKSu; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e24si924290edc.488.2020.10.21.01.59.22; Wed, 21 Oct 2020 01:59:44 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=GlmFnKSu; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394935AbgJTQ5E (ORCPT + 99 others); Tue, 20 Oct 2020 12:57:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389033AbgJTQ5E (ORCPT ); Tue, 20 Oct 2020 12:57:04 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28D16C0613CE for ; Tue, 20 Oct 2020 09:57:04 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id m20so2793646ljj.5 for ; Tue, 20 Oct 2020 09:57:04 -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=Mtc3WNzBPX11pj9hfnNahfSocHaX3H1JChHDUVakoB6PJL1qsMlLTbXnAln8nuiYZw IreaZLQBCUFp+gp7E0VShabt5gzKj1grT5K5T8V81A22d0DHVAsj8nC8p7t/zzsoEV+U NxmPWwIgXcM6Slwbs48wyO/PiFkGgC2y+Dv/DHQWQ6LMYWynux+tVZEMyuCynepGWwAn vz5bdPSoYCH2WSWjSqkgYJKbRrw8zXdfURSAB3yVi8uBJ/G9o6xeGUJ9lRLm/p5GSaJJ IwvnIuC1gCoOENDtiZZxidrnC/yFJ0XUrTGVHTRGOhScyQRPq7JWR/HwUEUmV3da9k9j 1J6A== X-Gm-Message-State: AOAM533vAkaN2SuVPI/BVBmK1dm1lu6AsRui0Z42LNGniCUyTDA1+Ajv W8LJ4RKvd6GakpO+LIMNdIYHFcOlmjEO1iQJSUeeOw== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.