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 05068ECAAD3 for ; Thu, 8 Sep 2022 02:43:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D9716B0072; Wed, 7 Sep 2022 22:43:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 789126B0073; Wed, 7 Sep 2022 22:43:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 650AC8D0002; Wed, 7 Sep 2022 22:43:47 -0400 (EDT) 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 526536B0072 for ; Wed, 7 Sep 2022 22:43:47 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2E2D01C6C19 for ; Thu, 8 Sep 2022 02:43:47 +0000 (UTC) X-FDA: 79887372894.30.8CCD424 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by imf12.hostedemail.com (Postfix) with ESMTP id DBBB64008C for ; Thu, 8 Sep 2022 02:43:45 +0000 (UTC) Received: by mail-ej1-f46.google.com with SMTP id bj12so34742163ejb.13 for ; Wed, 07 Sep 2022 19:43:45 -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=1Kp8lVSbVqh0xdCaSGzBnGS0KimrRJEGXexqvO+A61k=; b=VU3x/RATySGCqkn35FuoVNPIlVepIfpPqgHywrVV6qyGcNNaafm8aZ8BLY70OtBm8O 7B2qayTgwJ3sgII+LEWkS6NTw3tVAR1E6MLM0fQeIcQhqPItOa+d/+7V+dCP/Mdq8RgN 02dVJ/2tCG0NmAFC75e/nIAYNd+tVV8TAOTDpnLEmsm8EVE8OQebqMYLwlUBhIyix0vj awJTD1sijvEhwy/eBYewmdFWk4Rhlo/e0CMllu3BEgKQFjY/A6XNhpG6SyJmXW9tgMt7 GXQZAQdAwX/2KlD+gHx4uBCwhxHE0Zp1cW4rE+kqQkCLH54uuYRLqZbMrlkVhwbnKKPF AINg== 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=1Kp8lVSbVqh0xdCaSGzBnGS0KimrRJEGXexqvO+A61k=; b=Juu28n/HdPbIwdheuNpAWlB6KCLzelmMt+AatGMXyXLi60pj8nJwVhGRBmnnSRn/O7 2ZJythEX2UBHgdAU7ScpyaX9zI1pxg2fNAcvEvpsA3LOFWrBosAlS7lVODIxgeV9KLUO 7FK4rz0Q23KGIjVOBpSDrxRy/Pgwwu6VC0Jq0/3l6IJZihRU+Ny87RFr0c8TD1gh7dPt vEEW3rhPld0QSaSTRDrYwu2J0mjDZ3KwD/G1qhmSvwk9ld1Jtq9gUcrgYnKhgW2i0cOF E3i1o6dcgMbRY7GOs0c4ExPTameh9sA10ItybO2RuXBSAUTt1a06slgO8w0+H4oojVtX 6Byg== X-Gm-Message-State: ACgBeo0NIrJNZ2AQxy777VfoA4GX/aZ6TSr7PmuUohnIax3PHu9JwPw+ +Oau4Kec4BseZ1yo93f2Wab0HQ0qtA8VZ8rVtGc= X-Google-Smtp-Source: AA6agR728kGj9mp65ybKd5ugwGh1WxmY+DSTIg1OQyFpIInFinhIgvFQ72NHe18Wr5xU5wWoSb94EcYU8qJp+G1h7Y0= X-Received: by 2002:a17:906:ef90:b0:730:9cd8:56d7 with SMTP id ze16-20020a170906ef9000b007309cd856d7mr4214987ejb.94.1662605024595; Wed, 07 Sep 2022 19:43:44 -0700 (PDT) MIME-Version: 1.0 References: <20220902023003.47124-1-laoar.shao@gmail.com> In-Reply-To: From: Alexei Starovoitov Date: Wed, 7 Sep 2022 19:43:33 -0700 Message-ID: Subject: Re: [PATCH bpf-next v3 00/13] bpf: Introduce selectable memcg for bpf map To: Yafang Shao 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-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="VU3x/RAT"; spf=pass (imf12.hostedemail.com: domain of alexei.starovoitov@gmail.com designates 209.85.218.46 as permitted sender) smtp.mailfrom=alexei.starovoitov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662605025; a=rsa-sha256; cv=none; b=HRBIvZ0zFlDmf8HBRvIEK+Z1uXp7Q+vjBGOuMB1YmjvELobmfXMqPVr3HA+kIJkc76MAPq C0k8GW/Fq3asWwbEsXSKUFTEyNiQqrnyyqbHOufhtI323t5woCYZM2txydV5Qd//sVH0y2 iyCfHXPe4+QtMUMcTixntpg2dXHjZBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662605025; 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=1Kp8lVSbVqh0xdCaSGzBnGS0KimrRJEGXexqvO+A61k=; b=7qKxKGvX7WXhaOO6nJ1doSQKh30xFlfvjJ2cYLlVdQf4BbNP/pXamZkTL2CFfKFPcGS38D WCpun8P/plfE99b/3nkH/zpBJPJ5bS3yNhqtsnTrzOEt6ynRFDiq7XY4Pn116mpQkUSdod ZPAamG4QdhmlcgMet4NGnV9FqkR5cbc= X-Rspamd-Queue-Id: DBBB64008C X-Rspam-User: Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="VU3x/RAT"; spf=pass (imf12.hostedemail.com: domain of alexei.starovoitov@gmail.com designates 209.85.218.46 as permitted sender) smtp.mailfrom=alexei.starovoitov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam01 X-Stat-Signature: 6ne7m71s8bak3o6qzn4k8wpsa9of1s8r X-HE-Tag: 1662605025-826884 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 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. 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.