Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp344335rwo; Fri, 21 Jul 2023 12:48:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlG6Kt7WLlVcZBBxXcLV4ZZu464FoSTcCTa5/01gZkJIM5X+Dh6EE7Zh8/QzP6OOfB6tMhRi X-Received: by 2002:a05:6402:69a:b0:51b:ec86:b49a with SMTP id f26-20020a056402069a00b0051bec86b49amr2172463edy.7.1689968888619; Fri, 21 Jul 2023 12:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689968888; cv=none; d=google.com; s=arc-20160816; b=OE2YZD9BRLUJJBicBwjp+4lLNhJafvjLOcpSeTCKlpCV2cqmvbj5arvKgy6G/9WNtS yFgo4oPSo/ML9/VzkH3XzTXDHUcEBhCvTAhm7dpfDu+zx3+F2WNUeDONKB0N1c5u1DAn wSlBpOmM68HATbBSEUo55taVCY1meWE2m5XrmWhfTbJBOvlwkzm0AnsKCStWYlL9D66z 0Mj/F40o1ucx3llQEMxrKtWXk210OQYUn9olRfStWBU8YGaPj4L++3tXb/+l9FTf0KxK 1DMnNPZLblAN6gn/oXh0uAtdZ7APhv4Eyi6J1T5GfbUCnPG+1cQZ7Itei4R1sq09h5MQ PSRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=sxUJQYgkClQx653D+GLhwGjuASPJZY3UChFEBbRQygA=; fh=SCwsqN2ULYPOVetMiP4evZzfXVi9Vxa0nfF6kSzIwFU=; b=NM95+r/NZv85VDH7WRue6X81uaBUsf7j0/Nmpqor300OjzPKKq1lWNqNKtKYonKL5v RPl36MarGBbYqA13jJhOdhmSOM8KmeklZiareScEgV9oFIogRmxx/QCF6ESRc5CAjN0D pZtuPaphaA4D5DeaAoO2fWLSVt//3XauK5yJQPFgJEnBJhzAGU/O1fuWcY6uFnXmsuJf Z9S7zBKChwLN9HeXAt58P+L7lU/l4ain4CiNCMo5OgBVkfhvjT36rlaBEual5SFsQ+CK i2w+VpmtIasap4L7uoLDIIZ5UUFK25e1mTUp74AjUJ7LGEgZNbuCH0tQ+gbbgCSfl1cp Y+HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="mAkNV7/T"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k5-20020aa7c045000000b005218239ce1asi2517203edo.208.2023.07.21.12.47.44; Fri, 21 Jul 2023 12:48:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="mAkNV7/T"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232037AbjGUTSc (ORCPT + 99 others); Fri, 21 Jul 2023 15:18:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232034AbjGUTSa (ORCPT ); Fri, 21 Jul 2023 15:18:30 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D18330ED; Fri, 21 Jul 2023 12:18:27 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1b8b4749013so16938125ad.2; Fri, 21 Jul 2023 12:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689967106; x=1690571906; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :from:to:cc:subject:date:message-id:reply-to; bh=sxUJQYgkClQx653D+GLhwGjuASPJZY3UChFEBbRQygA=; b=mAkNV7/TkrTRt+4xRyYVs8bvaw/fK1B7/XnSKv8lxCseRRpsGfLzQfkVn+eOClOviz 88azYzYMlLiQwxDNiTu9AYJAdsHizyT/BwQ8Plm2itEb9RnWNeRgCSFf4EdIS16a1sak aYRBKLeMZQMW9EVuXp0t0qMaCiRc1rHmVMWfmOh5gDdfXGa0oG+YG2830o3mTPdvHL6e vH9U7Mt3P3EmCao0guiqhKMLkn+xj3uxeSldJ3kgXK9mSNRmQ8CAWR6EavAWBeJ6WDMN pp1i6eklTZCez9JN3tl2Y/wC2ZsyC0RyRmxlVGUPhyrr/flYK7KV0HpNYHCV9Cf2ZY33 kxfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689967106; x=1690571906; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sxUJQYgkClQx653D+GLhwGjuASPJZY3UChFEBbRQygA=; b=Vt6/cjf7psGIRBjRlT5vBt5u1R5ZcGos20AzIZ0AXXlM0jkYp3GgbwPWVrzk6k4w5b VqA40+R4ZgcH5iHR3EWa0SORAnWFg0vkvH/uuwJIxrJGs5ftgKVbr3lBR8I9L0NRo9Yh jZ+W9mHER4CoZjgSrr3iB5r/1ayyKEd/8HiGWi1VDvgujyd3CzFDG1WiQIQ0Vf18dV3F m2YNRp75VtJU7Qq2K8mT+MnKDGzI4n2W1AwMJqQ4WyvBLFHTONyy3rb/vQNgFgzzKLRN Vi3eSpMkP7FcrZeMPL4JpoEx4d3f9ndBJRq65DkpE6klWRzWxcp2Rs+frpCek7g+EV1q pGPw== X-Gm-Message-State: ABy/qLaCI9bLW41FvNiTbeCl/XbkkwXLPbTgNyWCgJRkgqE4uOCKhEEa x1Zek9/o+rF6oLKEfl1VG5U= X-Received: by 2002:a17:903:120f:b0:1b8:4b87:20dc with SMTP id l15-20020a170903120f00b001b84b8720dcmr2917727plh.37.1689967106467; Fri, 21 Jul 2023 12:18:26 -0700 (PDT) Received: from localhost ([2620:10d:c090:400::5:fbd8]) by smtp.gmail.com with ESMTPSA id d14-20020a170902728e00b001b88da737c6sm3855710pll.54.2023.07.21.12.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 12:18:26 -0700 (PDT) Sender: Tejun Heo Date: Fri, 21 Jul 2023 09:18:24 -1000 From: Tejun Heo To: Yosry Ahmed Cc: Johannes Weiner , Andrew Morton , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , "Matthew Wilcox (Oracle)" , Zefan Li , Yu Zhao , Luis Chamberlain , Kees Cook , Iurii Zaikin , "T.J. Mercier" , Greg Thelen , linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org Subject: Re: [RFC PATCH 0/8] memory recharging for offline memcgs Message-ID: References: <20230720070825.992023-1-yosryahmed@google.com> <20230720153515.GA1003248@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Fri, Jul 21, 2023 at 11:47:49AM -0700, Yosry Ahmed wrote: > On Fri, Jul 21, 2023 at 11:26 AM Tejun Heo wrote: > > On Fri, Jul 21, 2023 at 11:15:21AM -0700, Yosry Ahmed wrote: > > > On Thu, Jul 20, 2023 at 3:31 PM Tejun Heo wrote: > > > > memory at least in our case. The sharing across them comes down to things > > > > like some common library pages which don't really account for much these > > > > days. > > > > > > Keep in mind that even a single page charged to a memcg and used by > > > another memcg is sufficient to result in a zombie memcg. > > > > I mean, yeah, that's a separate issue or rather a subset which isn't all > > that controversial. That can be deterministically solved by reparenting to > > the parent like how slab is handled. I think the "deterministic" part is > > important here. As you said, even a single page can pin a dying cgroup. > > There are serious flaws with reparenting that I mentioned above. We do > it for kernel memory, but that's because we really have no other > choice. Oftentimes the memory is not reclaimable and we cannot find an > owner for it. This doesn't mean it's the right answer for user memory. > > The semantics are new compared to normal charging (as opposed to > recharging, as I explain below). There is an extra layer of > indirection that we did not (as far as I know) measure the impact of. > Parents end up with pages that they never used and we have no > observability into where it came from. Most importantly, over time > user memory will keep accumulating at the root, reducing the accuracy > and usefulness of accounting, effectively an accounting leak and > reduction of capacity. Memory that is not attributed to any user, aka > system overhead. That really sounds like the setup is missing cgroup layers tracking persistent resources. Most of the problems you describe can be solved by adding cgroup layers at the right spots which would usually align with the logical structure of the system, right? ... > I believe recharging is being mis-framed here :) > > Recharging semantics are not new, it is a shortcut to a process that > is already happening that is focused on offline memcgs. Let's take a > step back. Yeah, it does sound better when viewed that way. I'm still not sure what extra problems it solves tho. We experienced similar problems but AFAIK all of them came down to needing the appropriate hierarchical structure to capture how resources are being used on systems. Thanks. -- tejun