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 A6024C00140 for ; Fri, 19 Aug 2022 00:59:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0BF728D0003; Thu, 18 Aug 2022 20:59:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 06EC18D0002; Thu, 18 Aug 2022 20:59:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E515A8D0003; Thu, 18 Aug 2022 20:59:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D34288D0002 for ; Thu, 18 Aug 2022 20:59:58 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A89521C68EB for ; Fri, 19 Aug 2022 00:59:58 +0000 (UTC) X-FDA: 79814535276.20.7ADA4B0 Received: from mail-vk1-f179.google.com (mail-vk1-f179.google.com [209.85.221.179]) by imf28.hostedemail.com (Postfix) with ESMTP id 0C890C0011 for ; Fri, 19 Aug 2022 00:59:57 +0000 (UTC) Received: by mail-vk1-f179.google.com with SMTP id t64so1589090vkb.12 for ; Thu, 18 Aug 2022 17:59:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=XmfAUBn1gArqpjhXlxsozSzKVKhtwcuq/x+I+Cb3JzY=; b=Qo3NPm1+YvEv8c/eNWWuQFae5XughAMFYdkSqiR35cDKbnL8eJWtPd0Qvb5yLNCtMC 0yZnB5M4GAGOEqeZ6Y3z5l6Xnr5D2ly83lWAX3lQmYV+Cd7UO/2krUBvtRMrdjf/GWZM KIt5Zfdjv1m1Br4cZlsYbCTFbYv/lOmKgYjnqyqKQGqW8bjmYPopiDWCj0L9VoQXlo0E 8bzWAqhogkYmdRNYJDWi05oP9XPaZWRT8LUFfgst0CIC3mIRU6GJKnueDWqUioS5Efub xXxg6xCAZ+pX8K/X2jQ7JHrX50aTo7L9D23bKrhlSF3HnWi8sZ92KFjfYELFZBqadizo VkbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=XmfAUBn1gArqpjhXlxsozSzKVKhtwcuq/x+I+Cb3JzY=; b=l3xYl/CMzDndgnmCCIEijeR1lZyaw1tB4j2djYLompP/QXsPNuO6GF8ofEJN80SNw6 yqZQu+AoCxbaw7PLocn8tLLTwBiVlos8zgwli28Z/+iNKxse4U0zVTxv5bcF+1SOBwYZ 6yYuOq7jtUTpODibI0++cWxOK8hlxTf7KEYIMMAZnV18x3T3dgUZhCQY4vsuHp0zztl9 eXvL2fv1eRZnplgCo6VwV8au4zqCzJ5ZZbj4JDTT5HZ9wVK32CordVaSJ9ADyuUZplc/ wWGCzCNxhCXU1SFtQk3l9itn5GUVnn1MpuEP3Rmv26ZpvVY+sKppliGOBYh0eDg4XLem 9rFA== X-Gm-Message-State: ACgBeo1aIOT+rVPptmN33FuOiQqPoQh84bWvwqD8VlZLpiDE0J7zjlWL 9lNguOksEYIH+tNf1peteIDH6AAQxrFmqGf7yI0= X-Google-Smtp-Source: AA6agR4z9O4ng7MR/K7VSMtafo49b8X4OSLL8KeOKzrQ51KNyScyZXPsVkxF0WgmkYDssPirwhyDHTyw0JGjzd78feE= X-Received: by 2002:a1f:251:0:b0:380:d262:4f4f with SMTP id 78-20020a1f0251000000b00380d2624f4fmr2294285vkc.5.1660870797677; Thu, 18 Aug 2022 17:59:57 -0700 (PDT) MIME-Version: 1.0 References: <20220818143118.17733-1-laoar.shao@gmail.com> In-Reply-To: From: Yafang Shao Date: Fri, 19 Aug 2022 08:59:20 +0800 Message-ID: Subject: Re: [PATCH bpf-next v2 00/12] bpf: Introduce selectable memcg for bpf map To: Tejun Heo Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin Lau , Song Liu , Yonghong Song , john fastabend , KP Singh , Stanislav Fomichev , Hao Luo , jolsa@kernel.org, Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , lizefan.x@bytedance.com, Cgroups , netdev , bpf , Linux MM Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660870798; a=rsa-sha256; cv=none; b=AnXfl5Uj/MtXCIRC3ESoTsUGGm+N0HQiRp9yiZwvS1S+CG2lN1NEWI4nNs2uZpDWhSJmtd Ag+8eNXy5ITMH9/M0HyIKlMqmpJzxo+hYx4gnAL7sUddlN3WkXY0hpa9z01ba1a9EPPqNa usMmSUbFQmBqKSIuKU3214DkKclgmX8= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Qo3NPm1+; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.221.179 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660870798; 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=XmfAUBn1gArqpjhXlxsozSzKVKhtwcuq/x+I+Cb3JzY=; b=gfTDJdsSznQvo/fgsQoPTUnWeZJbfEyLWtCQ6px80L14SZMuKNzhXnvWAr59KAwAbBhmoR BJNgbkcoW5v6tBBMysLhqSbT792XRHJebcwhGtuQgJbUxeXBIr4XIpCyg+m0Ta70WyQLys UGU4M6rwDwcJLKEkI5mkZuvGIyHyftQ= Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Qo3NPm1+; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.221.179 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com X-Rspam-User: X-Stat-Signature: smkciim8itd1kchouw5ppeqnuf7jf5ox X-Rspamd-Queue-Id: 0C890C0011 X-Rspamd-Server: rspam03 X-HE-Tag: 1660870797-61025 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, Aug 19, 2022 at 6:20 AM Tejun Heo wrote: > > Hello, > > On Thu, Aug 18, 2022 at 02:31:06PM +0000, Yafang Shao wrote: > > After switching to memcg-based bpf memory accounting to limit the bpf > > memory, some unexpected issues jumped out at us. > > 1. The memory usage is not consistent between the first generation and > > new generations. > > 2. After the first generation is destroyed, the bpf memory can't be > > limited if the bpf maps are not preallocated, because they will be > > reparented. > > > > This patchset tries to resolve these issues by introducing an > > independent memcg to limit the bpf memory. > > memcg folks would have better informed opinions but from generic cgroup pov > I don't think this is a good direction to take. This isn't a problem limited > to bpf progs and it doesn't make whole lot of sense to solve this for bpf. > This change is bpf specific. It doesn't refactor a whole lot of things. > We have the exact same problem for any resources which span multiple > instances of a service including page cache, tmpfs instances and any other > thing which can persist longer than procss life time. My current opinion is > that this is best solved by introducing an extra cgroup layer to represent > the persistent entity and put the per-instance cgroup under it. > It is not practical on k8s. Because, before the persistent entity, the cgroup dir is stateless. After, it is stateful. Pls, don't continue keeping blind eyes on k8s. > It does require reorganizing how things are organized from userspace POV but > the end result is really desirable. We get entities accurately representing > what needs to be tracked and control over the granularity of accounting and > control (e.g. folks who don't care about telling apart the current > instance's usage can simply not enable controllers at the persistent entity > level). > Pls.s also think about why k8s refuse to use cgroup2. > We surely can discuss other approaches but my current intuition is that it'd > be really difficult to come up with a better solution than layering to > introduce persistent service entities. > > So, please consider the approach nacked for the time being. > It doesn't make sense to nack it. I will explain to you by replying to your other email. -- Regards Yafang