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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,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 0FCCFC433DF for ; Sat, 16 May 2020 00:13:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C11922078B for ; Sat, 16 May 2020 00:13:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="khnNG9Gz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C11922078B 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 5A07B8E0003; Fri, 15 May 2020 20:13:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 527D28E0001; Fri, 15 May 2020 20:13:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3EEDD8E0003; Fri, 15 May 2020 20:13:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0145.hostedemail.com [216.40.44.145]) by kanga.kvack.org (Postfix) with ESMTP id 2317C8E0001 for ; Fri, 15 May 2020 20:13:26 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C6806181AEF07 for ; Sat, 16 May 2020 00:13:25 +0000 (UTC) X-FDA: 76820657970.22.wood76_ce400e3714c X-HE-Tag: wood76_ce400e3714c X-Filterd-Recvd-Size: 5133 Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Sat, 16 May 2020 00:13:25 +0000 (UTC) Received: by mail-lj1-f193.google.com with SMTP id l19so4043203lje.10 for ; Fri, 15 May 2020 17:13:25 -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=QTdULXcDq8mWIqVt/vb5iveO+2D6SqGvUKrtXPTBlEY=; b=khnNG9GzJUWCDxebtBF/4SavVHZ5K1XVmzcmgB8knXpmAzpoznXX+GI9LUIEsyDAcp GUkYxYruKzYaE5t9D9vzn9Z7zJ7WMbaTwiH7VLJ9NQc8HeZWG7+fDpWgURK/eWD/DH4O ejsL7skauXPqicLPunbijV2jvsyfstyagkjzmcTAr/665lf8yhJBCrE07ofIUASR7iA2 BOkXaXCY41lrexJKBFg1zxnhmDIfyPzIKpXlLzSFJ/VPZ51QjyNaGayYpEKSTbDZlDkb FFO1Lh0zAS2dlKKwpAwHMOdvzL+cLdkPzJCUogXkEGptCbxijQgqiaBsvY72KFyF0FX2 1ZJw== 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=QTdULXcDq8mWIqVt/vb5iveO+2D6SqGvUKrtXPTBlEY=; b=jz2NSD8v7xkX/ysbK/HycjpVpNMwM6FaYL+gkWeWaG7WJ2P+UTI0rU4zlpiXvgsNv5 ++KqgUhKdosrPAeKMMAu89S90qPEfxFJMwy438fNeEPxg/+L9LWAgquJtAQVdbhmmptl pH4D8YQVegjwII3sw2b+ncAHgU7D6mFgwl14n0W6oUqwMZaUbdot7AVW7EXsmJUIHt1k 9BHg4UWNVZMhnLt8jeM5c9x6xqOt0FLPLG4inlthTzyGM5lMZBkUEQFzFciOIsNxMlvr Wet9IepE9F5SsPgvpk33uELm68WxWmaPCNOAijTGuyxGRljrWEyqewOlRhWu8NHL6ANq WVyQ== X-Gm-Message-State: AOAM5305TixPPPXrJFHcVoCGNc3Nz0op4qf9MBTUbH6pZb0WluljIbIv rwZrgln2VdtR8TC2XGrzSVuhDUxn93zHetdJHb4vpA== X-Google-Smtp-Source: ABdhPJzCemLFHNysuQhPLwnUO9alB3xOu3pbsEDmt8LRl23pPio5lzKzbN+sh/P7UI1NHgHk+9B8IC1XAG146ugHLaw= X-Received: by 2002:a2e:9795:: with SMTP id y21mr3714912lji.115.1589588003829; Fri, 15 May 2020 17:13:23 -0700 (PDT) MIME-Version: 1.0 References: <20200508170630.94406-1-shakeelb@google.com> <20200508214405.GA226164@cmpxchg.org> <20200515082955.GJ29153@dhcp22.suse.cz> <20200515132421.GC591266@cmpxchg.org> <20200515150026.GA94522@carbon.DHCP.thefacebook.com> <20200515180906.GA630613@cmpxchg.org> In-Reply-To: <20200515180906.GA630613@cmpxchg.org> From: Shakeel Butt Date: Fri, 15 May 2020 17:13:12 -0700 Message-ID: Subject: Re: [PATCH] memcg: expose root cgroup's memory.stat To: Johannes Weiner Cc: Roman Gushchin , Michal Hocko , Mel Gorman , Andrew Morton , Yafang Shao , Linux MM , Cgroups , LKML Content-Type: text/plain; charset="UTF-8" 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: On Fri, May 15, 2020 at 11:09 AM Johannes Weiner wrote: > > On Fri, May 15, 2020 at 10:49:22AM -0700, Shakeel Butt wrote: > > On Fri, May 15, 2020 at 8:00 AM Roman Gushchin wrote: > > > On Fri, May 15, 2020 at 06:44:44AM -0700, Shakeel Butt wrote: > > > > On Fri, May 15, 2020 at 6:24 AM Johannes Weiner wrote: > > > > > You're right. It should only bypass the page_counter, but still set > > > > > page->mem_cgroup = root_mem_cgroup, just like user pages. > > > > > > What about kernel threads? We consider them belonging to the root memory > > > cgroup. Should their memory consumption being considered in root-level stats? > > > > > > I'm not sure we really want it, but I guess we need to document how > > > kernel threads are handled. > > > > What will be the cons of updating root-level stats for kthreads? > > Should kernel threads be doing GFP_ACCOUNT allocations without > memalloc_use_memcg()? GFP_ACCOUNT implies that the memory consumption > can be significant and should be attributed to userspace activity. > > If the kernel thread has no userspace entity to blame, it seems to > imply the same thing as a !GFP_ACCOUNT allocation: shared public > infrastructure, not interesting to account to any specific cgroup. > > I'm not sure if we have such allocations right now. But IMO we should > not account anything from kthreads, or interrupts for that matter, > /unless/ there is a specific active_memcg that was set by the kthread > or the interrupt. I totally agree with you but I think your response is about memory charging in IRQ/kthread context, a topic of a parallel patch from Zefan Li at [1]. Here we are discussing stats update for kthreads e.g. should we update root memcg's MEMCG_KERNEL_STACK_KB stat when we allocate stack for kernel threads? [1] http://lkml.kernel.org/r/3a721f62-5a66-8bc5-247b-5c8b7c51c555@huawei.com