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 A08CEECAAD3 for ; Thu, 8 Sep 2022 02:48:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 431E18D0002; Wed, 7 Sep 2022 22:48:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E1756B0073; Wed, 7 Sep 2022 22:48:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2AA588D0002; Wed, 7 Sep 2022 22:48:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1C83E6B0072 for ; Wed, 7 Sep 2022 22:48:42 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id E8270C09C9 for ; Thu, 8 Sep 2022 02:48:41 +0000 (UTC) X-FDA: 79887385242.01.72D6683 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) by imf22.hostedemail.com (Postfix) with ESMTP id 9A18AC008D for ; Thu, 8 Sep 2022 02:48:41 +0000 (UTC) Received: by mail-lj1-f173.google.com with SMTP id y29so5661968ljq.7 for ; Wed, 07 Sep 2022 19:48:41 -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:subject:date; bh=S007uhudJiEUSw5VwxgkV7xB4iqXJLx8bGrjx4fe7Ec=; b=Wynxkd/Lh2b+ogTbqK96/Gt6zE8OZeDngoOQzpEIsMlpgLwgwooTbQV5YtjXg+k+43 UspSoj/yZnUA2/GoXB9T2DiNXkYLbKF4nXr6Ui8BwkpzIXGa9GwJq+SrJNBX7i2yXbdg BfpSllT6UIpzwxu9DLlXK9/1LAXbzA0p4z7ahPmrQIzQB2ovJI9+TvXYJE2+FKSvAGjQ 3GXNk8TxFQMKZ3d93OIEUlyB05I+Uvqq/2ynKBJCQWJkYwwRYWpoewHgCVzlHSaru083 ACQrWwhViZfE479uxHlF7W8EID7aiLjo/amxw7glHDaVnxPhJivreP+95GHsAcfCSsJW Y3hg== 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:subject:date; bh=S007uhudJiEUSw5VwxgkV7xB4iqXJLx8bGrjx4fe7Ec=; b=C57EPUmcjSGZj0vskqePJEduhmPlPCr1Z5Ewq+F+FX8TuTEkbVql2f1Q8eiBtcgCv6 Ws67Yu/wJwlSpiAsEueFNzeYbW5lWrjSzpAvgfuRlPC6OwRQRXhaEEP+E1/r3M33NPxs xzOf79R5gEZyIKyCUscumaIQuBqJcfBjgPOBuklQr4FdTyCm9WM2M/8J01mKa7Wl4I+V wU9CWMSxN0U3QahPBJ8ayxFEaAyh1USwtAbRuPO9igHlFG5pfv6RY5huUABZmNIoEzc5 n/mieAWn9ulcNefRXSiD2WiPcKE4JlDnhIfPu9n5XGZLFryO6e+0qZUqFQbyQ5GYyQ3M +WIg== X-Gm-Message-State: ACgBeo1xUQyUXiWNPUHK2dKUkxZS6tm8pRzJ+3Tobvyv/dCPpHbJ2lLL 7w+OpPORwI149bizUz3HAyMr4k05LefSFqW3tyU= X-Google-Smtp-Source: AA6agR51DPksjb7gaR1DJ20WyBaKaOQEPNurBKQksz7/9Z2PW16bQ3gm9ag9gGKHTWzQzy+kZcizRIHGLZcNsqiLDVA= X-Received: by 2002:a2e:91d7:0:b0:26a:c623:ad26 with SMTP id u23-20020a2e91d7000000b0026ac623ad26mr1838663ljg.512.1662605320251; Wed, 07 Sep 2022 19:48:40 -0700 (PDT) MIME-Version: 1.0 References: <20220902023003.47124-1-laoar.shao@gmail.com> In-Reply-To: From: Yafang Shao Date: Thu, 8 Sep 2022 10:48:03 +0800 Message-ID: Subject: Re: [PATCH bpf-next v3 00/13] bpf: Introduce selectable memcg for bpf map To: Alexei Starovoitov Cc: Roman Gushchin , Tejun Heo , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin Lau , Song Liu , Yonghong Song , john fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Johannes Weiner , Michal Hocko , Shakeel Butt , Muchun Song , Andrew Morton , Zefan Li , Cgroups , netdev , bpf , Linux MM Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662605321; a=rsa-sha256; cv=none; b=39QkiKORm7nn3TPkOJgDMj1bzC2jfgYdnNRGJ/RI1h9nBRUr9WErRByTVJ+I6yhrTi3p4F a949dKNosxsmZm94+ErEgmM8IKeZj7vDF0TsebFVaRUOkgN8tLO8A9CuAiCp5/DyyIKljF NmmPTyTwGrFywyNznGfY62Iquw5ym6Y= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="Wynxkd/L"; spf=pass (imf22.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.208.173 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662605321; 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=S007uhudJiEUSw5VwxgkV7xB4iqXJLx8bGrjx4fe7Ec=; b=5mI7BMnRKDmiokw0ip0UZxEVa0UXSa7Ai/bLLJxYHrn2AUW+I+iWYxkZzdLeukrdOB9w6+ bBPNQpIWIbOO/HYH/ZB7uuVayHgaAKLURiTVZs9ROeuSegVW4OpCrjawsVnyH6Iz5RIxnY nG6Fv5koasJKzWUi04lTD8nibkJK5To= Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="Wynxkd/L"; spf=pass (imf22.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.208.173 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: kkcx51kp4fc46z86xeuagctc4qs5esrc X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 9A18AC008D X-HE-Tag: 1662605321-716966 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 Thu, Sep 8, 2022 at 10:43 AM Alexei Starovoitov wrote: > > On Wed, Sep 7, 2022 at 7:37 PM Yafang Shao wrote: > > > > On Thu, Sep 8, 2022 at 6:29 AM Roman Gushchin wrote: > > > > > > On Wed, Sep 07, 2022 at 05:43:31AM -1000, Tejun Heo wrote: > > > > Hello, > > > > > > > > On Fri, Sep 02, 2022 at 02:29:50AM +0000, Yafang Shao wrote: > > > > ... > > > > > This patchset tries to resolve the above two issues by introducing a > > > > > selectable memcg to limit the bpf memory. Currently we only allow to > > > > > select its ancestor to avoid breaking the memcg hierarchy further. > > > > > Possible use cases of the selectable memcg as follows, > > > > > > > > As discussed in the following thread, there are clear downsides to an > > > > interface which requires the users to specify the cgroups directly. > > > > > > > > https://lkml.kernel.org/r/YwNold0GMOappUxc@slm.duckdns.org > > > > > > > > So, I don't really think this is an interface we wanna go for. I was hoping > > > > to hear more from memcg folks in the above thread. Maybe ping them in that > > > > thread and continue there? > > > > > > > Hi Roman, > > > > > As I said previously, I don't like it, because it's an attempt to solve a non > > > bpf-specific problem in a bpf-specific way. > > > > > > > Why do you still insist that bpf_map->memcg is not a bpf-specific > > issue after so many discussions? > > Do you charge the bpf-map's memory the same way as you charge the page > > caches or slabs ? > > No, you don't. You charge it in a bpf-specific way. > > > > > Yes, memory cgroups are not great for accounting of shared resources, it's well > > > known. This patchset looks like an attempt to "fix" it specifically for bpf maps > > > in a particular cgroup setup. Honestly, I don't think it's worth the added > > > complexity. Especially because a similar behaviour can be achieved simple > > > by placing the task which creates the map into the desired cgroup. > > > > Are you serious ? > > Have you ever read the cgroup doc? Which clearly describe the "No > > Internal Process Constraint".[1] > > Obviously you can't place the task in the desired cgroup, i.e. the parent memcg. > > > > [1] https://www.kernel.org/doc/Documentation/cgroup-v2.txt > > > > > Beatiful? Not. Neither is the proposed solution. > > > > > > > Is it really hard to admit a fault? > > Yafang, > > This attitude won't get you anywhere. > Thanks for pointing it out. It is my fault. > Selecting memcg by fd is no go. > You need to work with the community to figure out a solution > acceptable to maintainers of relevant subsystems. Yes, I'm trying. -- Regards Yafang