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 45699ECAAD3 for ; Thu, 8 Sep 2022 02:37:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CE0A66B0072; Wed, 7 Sep 2022 22:37:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C91436B0073; Wed, 7 Sep 2022 22:37:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B578E8D0002; Wed, 7 Sep 2022 22:37:42 -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 A787B6B0072 for ; Wed, 7 Sep 2022 22:37:42 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 82000AB643 for ; Thu, 8 Sep 2022 02:37:42 +0000 (UTC) X-FDA: 79887357564.31.1DAA62F Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by imf18.hostedemail.com (Postfix) with ESMTP id A10D91C0078 for ; Thu, 8 Sep 2022 02:37:40 +0000 (UTC) Received: by mail-lj1-f178.google.com with SMTP id z20so18241952ljq.3 for ; Wed, 07 Sep 2022 19:37:40 -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=7xfo1t0Mjz7JHwVeDqy2RVRwxIGPpSh2U8isoMwE4RM=; b=KEtUU7pliz21rp1lhfBEiM0Cbjd3FGNGwWUs94BdDhRfJX4Rg7Bb6438/dyEBJjDpm L9ep6h9h0SeW6QhSXcnKU7AFZovBkpZgIu7PDvCOE6euFRb+hgaoXyQU6farRWdFCOmo n8bIuS4vS14N+te+6ip/Q7e1kgsImF6P33OBEQbZy8qHbqwE+2ePOtq8S096fmKirqtL rNhx+t4j5UpvOMCg9EhUbuaKhNfs1b87a8tBGddVwcbfS1sAZ7v8XnxVGeyqFm91hgqh oqp1UmqH9FJi5seXCLUPzB8m02DeHDv2LiXI9ySAMvCt/JPETAcntavsX9t9AOZNM71k qVKw== 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=7xfo1t0Mjz7JHwVeDqy2RVRwxIGPpSh2U8isoMwE4RM=; b=TVYF9Qemgc4HPq800o8ypQkbQjVlR5h8JZTXYhWfXENOznIJgIqeJoz/LexLOR8boa HUY2he9FwT2ah4btromO0QMP+/zlyoLDM2HJRsTa8mA0+VfVrBZia2N/v/4ORZil7PgI RxMU2+ZfmqQTanb46ui1XPWrYJZYcYOQy2PYACCzRMdq4xawJk1K04yViOqGv7PxyFUk oV6CSmWKymwpfY9QKbJTrA8+n6Oe8++QM2HRQiZ0RLWLH4Qh5eeSgPeixklWGS3xtmQZ 1ou6KyYYPuq+pvWOqTpmTeFUoGxJbOUHFImGSEGoXGDdzYoLhYaMtRaDJp+SvuPOAR4A 87jw== X-Gm-Message-State: ACgBeo2i3rBgEvtl3dcUK2spA6pmikPJpL3I4DbdsSqrVBx6/1JjmDvY kTn9bb0ZAg8+HzwwfbDtyoJG2avg/qtPEvtXHU8= X-Google-Smtp-Source: AA6agR5wLhRP7P8RVkSNKMnybd00BQQnFi0JKo5dM7rfchYrLrBRpybhTeqEvt/5VFWe8433KIL3bXS4wbC9yU5L7Cc= X-Received: by 2002:a05:651c:211d:b0:266:20b6:ae57 with SMTP id a29-20020a05651c211d00b0026620b6ae57mr1745525ljq.108.1662604658953; Wed, 07 Sep 2022 19:37:38 -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:37:02 +0800 Message-ID: Subject: Re: [PATCH bpf-next v3 00/13] bpf: Introduce selectable memcg for bpf map To: Roman Gushchin Cc: Tejun Heo , 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 , 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=1662604660; a=rsa-sha256; cv=none; b=NzzTWI14xpYyi+/on52npV7IVt1QT5kDJ+CTrycMJbKvPiREq/mjxSmCHPiyMEmfLm87e3 9ZqQMz/NxFyUZlre1J5NdjqZntlz9+pnJ59FjudgtnKAMrNv9LkR32Huto176FcLg/r7Zw NbXqZ4/gFdQpr9p5IM9OWy1q1TAjxgU= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KEtUU7pl; spf=pass (imf18.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.208.178 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=1662604660; 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=7xfo1t0Mjz7JHwVeDqy2RVRwxIGPpSh2U8isoMwE4RM=; b=ZMj8DtS/IJk8CuvYGhtplzibnKGURn3flJRt4O37N62z9acNGGduUvlOXrYEIuyBizv0lv ugDFufPt2wQhuoAok0hJ61ECnheimgzQjm6IktGKEFp3FkOQSFEGDBSk0MZcXklyYG+bix x8rGcffhMbHz4V3A1ZV7I4/hTObKUJQ= X-Stat-Signature: cjrog3c1kju4q6wizonwmdp7ynba7coe X-Rspamd-Queue-Id: A10D91C0078 X-Rspamd-Server: rspam11 X-Rspam-User: Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KEtUU7pl; spf=pass (imf18.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.208.178 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1662604660-58966 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 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? -- Regards Yafang