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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73FA8C636D7 for ; Wed, 8 Feb 2023 20:54:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B85DB6B0071; Wed, 8 Feb 2023 15:54:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B0E516B0072; Wed, 8 Feb 2023 15:54:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9AF676B0074; Wed, 8 Feb 2023 15:54:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 85FC66B0071 for ; Wed, 8 Feb 2023 15:54:38 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2A32D1402F1 for ; Wed, 8 Feb 2023 20:54:38 +0000 (UTC) X-FDA: 80445328236.01.81541AD Received: from out-137.mta1.migadu.com (out-137.mta1.migadu.com [95.215.58.137]) by imf02.hostedemail.com (Postfix) with ESMTP id 4366A80004 for ; Wed, 8 Feb 2023 20:54:35 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="Ry7eN87/"; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf02.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.137 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675889675; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=8hTM8UpF2EtjSujDo7i2tE9vOByipsbn/8EnqcT62yo=; b=f+s5NlL8nXKt48eH5kQouQUv91KfjuO/oxaoKPBKSx2+yRjEnMSWxFN+cgs3M1ZrBZquJP b5yzj1U/8ofaci4R4Fw9Be4nO9sLSoUHI5WcHqD9k+kWBJIrG8KoNIVXeBBz2ntaH5WC+R yioO+5KjqTc1kUbZTgNrxpVuCDHKowc= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="Ry7eN87/"; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf02.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.137 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675889675; a=rsa-sha256; cv=none; b=eeX6SVe/TUHm6ts1MYHoeHEKC3Qc+Zl0aiVZSb/1ahNovMgkpF9bEosGu30EL0R9OQTvPr QFsj1SU5i93OyuAeehuvN1RgAACB4Fk8LSnLREUvkB6TQpnhVQ5lro0ae91HUAgRH97Ceg cNmE8i2ltBV9OqjrMeSL4sfTNkKZmQo= Date: Wed, 8 Feb 2023 12:54:10 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1675889672; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8hTM8UpF2EtjSujDo7i2tE9vOByipsbn/8EnqcT62yo=; b=Ry7eN87/TYrSA13FkeYWI7VOPAtMOfzHdTJfFZ2b7Nedf1QTqlEvqusjNketL0GRiON+HV ugDGe5+DwAr+yGSsSKxqPie6MJi6wD1IHSQk5YA8hIFUvfJD64qNjT2qxHL4INA59UHKzG 2FCaSYoG/O+/qRhiEw1+8qk5f4hQ6Ks= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Yafang Shao Cc: tj@kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, hannes@cmpxchg.org, mhocko@kernel.org, shakeelb@google.com, muchun.song@linux.dev, akpm@linux-foundation.org, bpf@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH bpf-next 0/5] bpf, mm: introduce cgroup.memory=nobpf Message-ID: References: <20230205065805.19598-1-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230205065805.19598-1-laoar.shao@gmail.com> X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 4366A80004 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: zjd3f8gykupubemgpt1yxtmk63ace8s6 X-HE-Tag: 1675889675-366075 X-HE-Meta: U2FsdGVkX196JdZVWUIj0VQIMFoVP5JVO5RxJqlMGklbDR059pwMyuC6KTUKY78SrNPcq9wqMPuTJQXnqxyhyk1ypFK3YcgxoJk+SlS0mIiD4DE6xYwErCy4txz+ow6IkzWsRNCjDV3I93Pp7+C+a580X25Z8HFtbn+2t3rNPcy+/n8hQoEiqkBMbrOffNFdOy9RcI6gJsdCrQHxhQvxUF3Bq24k7JgCFGcQDDXxpcS/ZSDtaLHBdlRgO1KV/Bsh0P89c5j7uraBv6jYOWhUYov60pJAO3CwAH9xrbydPh8mXsjivNRJ2jh7c0buQegXJZincqd2TXMDsmfmgheUAhwtyHRkReT4NeR4M7zr1ROrGG/5nGPkpJd46F4mXzebJpL0FnrazknZ0UACKvigEE769qPboDtQ0zraun2akj3bMTMUJnJyhCvq57QqXRJ1jwkvpP0nrCu9epezoz4lc19yYp5rhz1mcUB7lR7GBN1kus0gtCnzDbHnlD8BBMh0gsxUewdev75/Xj31T0pq1u4WO6ve2FpGuZtTd7u5925bF1bBQ/h8tSrBrrLNalUHeUnmtPYYLiEYjSbzQlMKOqnRkCfZJfPyaqmVTPcrb2eKEql6BoOBQ/Pl/2u8ieWWlgyjy8/a05/2/xty44zmD+JetmVEiexhNaQmqPXod1PVtJYWH4hN9Rgp3jRpKhkNQFLRuJOmBeva/8brTidblvuumshsCIwA4yMwfiVRTpp2Jyzj5Ib8/PWYa1kcPPr9aL0gWqIjtrKS4ulyG61rCBvjUJzbppq3YtZUEoURtqu5jYj9UgeL6130NP4bUR4VPAnbD59cMiK7gT+cPUNu2RKS834Bd8bDa6I/hXC2kDXYlF+I3QoUMrFi+NHewaAeibILdYdlbu5+nDCuB3+MgYZrFFKSxH6IGvFEKytBiG8Yn/Cw+6U6ZCR1yvAt2e4vXuHB/lIiuWBZksXL8c0 cs1yd3Hl iVe7QJ4/2kXARlVnMOqgFNesBwJ9p8wNdxtlkU5srUXGNcddxLyvtfLhac+VyxBJXNtbeNrHfdei1BZfPc2VpXglf0kH1mR1cAXbVmnIIOCxi/GqVWatUaqVg5eil3eG2s25CqGY2+FDg9QdPKkbV42x2BC0HpwbPIFu2Tv2hLFReIkYpOhPm+BAaY0fFuGMsbXSjm/YGUJOtzkkRdL/LKfox6NQmxpAy5QoVgnt4lkXhz40yl+WUtflqyFOhh+eq3vVpGuGXMofYi7H72hdfIz6akKEKq5l5io7V9gcqWSZzFmHzI3/7Gys1+DX3UVicFNwb3H3NXjxk10k= 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 Sun, Feb 05, 2023 at 06:58:00AM +0000, Yafang Shao wrote: > The bpf memory accouting has some known problems in contianer > environment, > > - The container memory usage is not consistent if there's pinned bpf > program > After the container restart, the leftover bpf programs won't account > to the new generation, so the memory usage of the container is not > consistent. This issue can be resolved by introducing selectable > memcg, but we don't have an agreement on the solution yet. See also > the discussions at https://lwn.net/Articles/905150/ . > > - The leftover non-preallocated bpf map can't be limited > The leftover bpf map will be reparented, and thus it will be limited by > the parent, rather than the container itself. Furthermore, if the > parent is destroyed, it be will limited by its parent's parent, and so > on. It can also be resolved by introducing selectable memcg. > > - The memory dynamically allocated in bpf prog is charged into root memcg > only > Nowdays the bpf prog can dynamically allocate memory, for example via > bpf_obj_new(), but it only allocate from the global bpf_mem_alloc > pool, so it will charge into root memcg only. That needs to be > addressed by a new proposal. > > So let's give the user an option to disable bpf memory accouting. > > The idea of "cgroup.memory=nobpf" is originally by Tejun[1]. > > [1]. https://lwn.net/ml/linux-mm/YxjOawzlgE458ezL@slm.duckdns.org/ > > Yafang Shao (5): > mm: memcontrol: add new kernel parameter cgroup.memory=nobpf > bpf: use bpf_map_kvcalloc in bpf_local_storage > bpf: introduce bpf_memcg_flags() > bpf: allow to disable bpf map memory accounting > bpf: allow to disable bpf prog memory accounting Hello Yafang! Overall the patch looks good to me, please, feel free to add Acked-by: Roman Gushchin I'd squash patch (3) into (4), but up to you. Thanks!