Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10145376rwp; Thu, 20 Jul 2023 15:38:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlHIjQnXDRnnmYSEcxk4tfqV7rORLTkNp0mf1IvPvok+HtEGXqxxy6QLxW3GPau5zSTv6RZO X-Received: by 2002:a05:6a00:ad4:b0:67a:31b7:456c with SMTP id c20-20020a056a000ad400b0067a31b7456cmr169910pfl.9.1689892684393; Thu, 20 Jul 2023 15:38:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689892684; cv=none; d=google.com; s=arc-20160816; b=LizffBxVmGjOeNEBSBAnS+tFF3aWjer4yuZnH+PTWYV6Ju/Xo6wR/uBA/tTj3wkn0t POkR3wod1SHMM87ei1hi4sITzbzUbCqgttp6lMUdkYsuY3tc7boJ/xyLzi4TCBh8nLf4 +0iSFyPY2/j3brLxins/rE0mNl1F3HatRhvf7U7cKGpR/CchJ76gUaPJ2qbQUwOtRh77 fXtjP3A4B2lv1mO/HDT7ewc8F0z5Inf7S5SMj0xObmL1GVuKEtmApg/kd+Gk3v4xXZ68 TwW0lAvRLYPk9IatqgKc2vWPuSuisJsn8/JSV9RNsVjG0Y67S5VA/zooATpAtTwHSO1x VJfw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=Yyk+1akDqEk5I4HX+iaGF6X13C0u0JYMqRauqkNOe8U=; fh=SCwsqN2ULYPOVetMiP4evZzfXVi9Vxa0nfF6kSzIwFU=; b=dX+09qABxM8l/I5sHu3inVJMhwuIZIxZuH/dlf46znAUl4zCK9HFz/dzUfJdeahwla N5hhuzIz9uOGv/IR7CQj/rE+TIwGCx4v3q+w5VeybgKZG5u+VrD2tFlftGmpARCtUftY 2KAASfPUPf4JfF8bmm+kTe3XGDAyphpyssZTWekmyPxj9RCuHU5KNkz9vJH0NAxuWzql Z/w85Em4jfvpBeRfCXx8bbTL2i1RqmCRbPTZvwk0oYMv/GwpYzfSmrH5NkYvcGgUD/c4 zd2bIT2/nN42RLG5Dr+qFm5FED8dN0x7MR3AONDweZVbsn50meCpkPe7ujrJQDrBbRhJ LKNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=NA0WXFjj; 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 fj19-20020a056a003a1300b0066871b54e15si1700674pfb.359.2023.07.20.15.37.51; Thu, 20 Jul 2023 15:38:04 -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=NA0WXFjj; 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 S229914AbjGTWMC (ORCPT + 99 others); Thu, 20 Jul 2023 18:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229613AbjGTWMB (ORCPT ); Thu, 20 Jul 2023 18:12:01 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82A5C186; Thu, 20 Jul 2023 15:12:00 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1b89600a37fso8660545ad.2; Thu, 20 Jul 2023 15:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689891120; x=1690495920; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=Yyk+1akDqEk5I4HX+iaGF6X13C0u0JYMqRauqkNOe8U=; b=NA0WXFjj0OpKZjyiDZaTzkQ3U0kUE85I86+6zcqR7zjTAjF17ktJr20AQoERxT02kC 2fR/wGnihnbW7LuV1LCk6+1Q4OEhkBDZdXqa0IdN4HU8ynq+somylkYx14dr75Fx24k9 CLBBCw7T3bJnCIx6Tr6zC2NqMGPq6pZ9oJLN8x9DS3fpqLvCo4/DxwBYqyOwzbdOyx5d XjbJleeCani28OQgN52POgHzpVfc5CqvCXovkl8WTPLRoOY2bBzjcLqQs6faAVYdXr5B nHATugm7zOyFNUl6WNEG6XkwJYQZUk+lNHVxDGzZ7zReCzBrHKbTxHmsauvt/8JV6eKR IWMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689891120; x=1690495920; h=in-reply-to: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=Yyk+1akDqEk5I4HX+iaGF6X13C0u0JYMqRauqkNOe8U=; b=Z5xi3qFLpHiuI1viqbTCscaHQz5DbioTxelLxVTVG8m4dfnuqeYRcjB2CeqU8g0h5y EJlIw+ibNfIas+bObfkNZUps+AwtsqdldbCnccGYAxItYy1wZulojNBUlxfTQYGk8Nw2 dta2I7cmnhKD9+KziQ9O2GRMXbC2StfE/03gxUMwMarVty2d9OJkhrMnbeyTQCeQDGdD 1KuRrs3/ajS3O0lVS4/AjlmD6QP49mIdpogxPE8phJK1GZivU/d39SlYMBOqEuwUG76F w+N5t3Jw+Mg5fnBZLJWdPM/C3AbnQkrRLisNSjgldbTYYhOeov8vin7n528dKdgsLPVG LQhg== X-Gm-Message-State: ABy/qLaASN1ppQlGmDpFlw6UXDFNmdLlphiOxANVPBsD9szVCYSHcxxz IFaGvsWp0vxgymZ9Uw6CDCk= X-Received: by 2002:a17:902:ec84:b0:1b9:de3e:7a59 with SMTP id x4-20020a170902ec8400b001b9de3e7a59mr381057plg.10.1689891119647; Thu, 20 Jul 2023 15:11:59 -0700 (PDT) Received: from localhost ([2620:10d:c090:400::5:fbd8]) by smtp.gmail.com with ESMTPSA id q8-20020a170902b10800b001b8baa83639sm1891440plr.200.2023.07.20.15.11.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 15:11:59 -0700 (PDT) Sender: Tejun Heo Date: Thu, 20 Jul 2023 12:11:57 -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=us-ascii Content-Disposition: inline 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_NONE,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 Thu, Jul 20, 2023 at 02:34:16PM -0700, Yosry Ahmed wrote: > > Or just create a nesting layer so that there's a cgroup which represents the > > persistent resources and a nested cgroup instance inside representing the > > current instance. > > In practice it is not easy to know exactly which resources are shared > and used by which cgroups, especially in a large dynamic environment. Yeah, that only covers when resource persistence is confined in a known scope. That said, I have a hard time seeing how recharding once after cgroup destruction can be a solution for the situations you describe. What if A touches it once first, B constantly uses it but C only very occasionally and after A dies C ends up owning it due to timing. This is very much possible in a large dynamic environment but neither the initial or final situation is satisfactory. To solve the problems you're describing, you actually would have to guarantee that memory pages are charged to the current majority user (or maybe even spread across current active users). Maybe it can be argued that this is a step towards that but it's a very partial step and at least would need a technically viable direction that this development can follow. On its own, AFAICS, I'm not sure the scope of problems it can actually solve is justifiably greater than what can be achieved with simple nesting. Thanks. -- tejun