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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, 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 4C1DAC433E0 for ; Fri, 15 May 2020 18:09:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E651720758 for ; Fri, 15 May 2020 18:09:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="PWW0GHaO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E651720758 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9459A8E0003; Fri, 15 May 2020 14:09:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F6398E0001; Fri, 15 May 2020 14:09:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E58C8E0003; Fri, 15 May 2020 14:09:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id 645458E0001 for ; Fri, 15 May 2020 14:09:29 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 12D505471D for ; Fri, 15 May 2020 18:09:29 +0000 (UTC) X-FDA: 76819740858.09.list47_188551523f10c X-HE-Tag: list47_188551523f10c X-Filterd-Recvd-Size: 4936 Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 May 2020 18:09:28 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id r187so610562qkf.6 for ; Fri, 15 May 2020 11:09:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=VtzLCBVok8XlbDgDkip+DgPbXfjB0Ty8UH/3nIag75g=; b=PWW0GHaOTt1grzeYKkoIvWRXSG1ezxAQ+T3eDFecYfulUEoEJYp420H3TUxznxZXQ1 9lmGHfjOikCYafK145P0664YqWXjwb4EGqCEWKoudJakCv8Dw1OXKswDI/STZl84s0oj FdHtIChT8Sant8We8ACswlssnUtp1DMS9fkJLszaFdnX3veOh9/6Cx9Liy4idE0Ng0ft t1uS6PEF6Jr4UxM7+nsO1+Vcco4BLQ36HwyN/C+YXmXX+cx7z/wgen2muSrBI9qh39hf 6/CXUnvoyK9hziUMbIPb/ehW4roSn+H/XCPV41JvgL3t2j69yBmk3DHDxruevgNlwBEx 927w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VtzLCBVok8XlbDgDkip+DgPbXfjB0Ty8UH/3nIag75g=; b=UEEsEZ5s5CofKGxzZRqplas+uAbmt0IXqwfkpAHi9WpGbt17F/JF6tNXqWYaaAT2NW imQ3JPUwjDp0mM4xHfBhr3pEFHBVIOb9+yN1ukJG5Lbk0R1RxM/hbFEmnrADczVYIr9/ QG6wmSYLWD24wCxzHxKfCL+/eFsdbd0AbyoA6CTvzLKWjwEJjfYDR/o+0lqR/hPn+XNs +vbFK1d/ZBFYus7l3ZiHg/Huo8l+TsMi/FT+Ny6+s4C2l8AX77EIxqsDMMqeebaqUsSi t8/HxZtkfrSn/YF6t+SeyWCJIqTi11yiRB7IfVdIkmeNv3CAomxG5NtlncfS4zLhKP8w Owgw== X-Gm-Message-State: AOAM5327BF0hP9J3RSDMv2DRrJ7qVly24oiHD3YZojD2I0X19NmRLT/x mJ/H99B/7Njf61WQLrwfTJNDsQ== X-Google-Smtp-Source: ABdhPJysqfBouqJQhvsnrhs4XntBJ+MuFFmcGCdoQqqmwUBGOQ1dCTh6LZSFcednwifZXtSzt759Bg== X-Received: by 2002:ae9:e418:: with SMTP id q24mr4580879qkc.69.1589566167550; Fri, 15 May 2020 11:09:27 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:90a4]) by smtp.gmail.com with ESMTPSA id z15sm2113327qkg.70.2020.05.15.11.09.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 11:09:26 -0700 (PDT) Date: Fri, 15 May 2020 14:09:06 -0400 From: Johannes Weiner To: Shakeel Butt Cc: Roman Gushchin , Michal Hocko , Mel Gorman , Andrew Morton , Yafang Shao , Linux MM , Cgroups , LKML Subject: Re: [PATCH] memcg: expose root cgroup's memory.stat Message-ID: <20200515180906.GA630613@cmpxchg.org> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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.