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 X-Spam-Level: X-Spam-Status: No, score=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 481F6C433FE for ; Tue, 8 Dec 2020 02:53:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 87552206B9 for ; Tue, 8 Dec 2020 02:53:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87552206B9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0055C8D0013; Mon, 7 Dec 2020 21:53:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EF7F98D0001; Mon, 7 Dec 2020 21:53:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE6B58D0013; Mon, 7 Dec 2020 21:53:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id C77D58D0001 for ; Mon, 7 Dec 2020 21:53:45 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8F16D1EE6 for ; Tue, 8 Dec 2020 02:53:45 +0000 (UTC) X-FDA: 77568594810.09.pipe72_0c07a57273e3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 6A38B180AD815 for ; Tue, 8 Dec 2020 02:53:45 +0000 (UTC) X-HE-Tag: pipe72_0c07a57273e3 X-Filterd-Recvd-Size: 5107 Received: from mail-yb1-f194.google.com (mail-yb1-f194.google.com [209.85.219.194]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Tue, 8 Dec 2020 02:53:44 +0000 (UTC) Received: by mail-yb1-f194.google.com with SMTP id v67so2403916ybi.1 for ; Mon, 07 Dec 2020 18:53:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Z8loPG8U58lIBTc9sYS7jiFOqCpefVAOcaLFNAdlAuE=; b=oEk3ysYj1UEoBp87Q3+GjmiJJih8MWcQeZaJNLM+81lwE94R6skRWZz49HmdQ9l9Ye DQIIZ+i0rqNVYS+3Qu05bJ1omqCYvmE7fauyuQAjChS9uiPHDIcz6Zi6tkkCLTekjnzh iuV4eEP45VObgdqssB22lijBhcpr6IDjs4RVxt6pB9WoCsKMm8Q9F167+z9qpuFNnPWV Tyy73zH56HAzob2aVoGh2JBKKiLua8wo0NPOUkbFv7on0vYMu+m7Ts+hkc43Iw7oXeBV gK/8ppbuWY+grT8FaXnhs+aMPZF/YxK4rAHcIEBzMLViwehwBWPKwqnplg4q4IgLAbEG r1cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Z8loPG8U58lIBTc9sYS7jiFOqCpefVAOcaLFNAdlAuE=; b=WaKyWvwYlfFtqqBHSHdhNoACWaL/FhOvcrZg/oAixc9FDHTA4ypr1AiaPR8x1H5gPL 7Ran42NuiIqgqw2lu2OWcrk3RKsGCzzYtsArl3FSS2yJtReYeHpCRAGttrk6H/ViX9x0 1orGZaDVWOxMV2U8MIGn850TqezHnJyAPbEv5FZi3UDPOw2k3Waw33obsj9pI0AqwclO Pu9xpAf6zjZKxVpZixSYhY8/OphgEYU3SnMiPHwzswjf557vIdx+6LbzuNmOtQ0WD/PA ME8w6MUKPJvhOF0MIwfgsd8+sbwYaYGeu/CNnLmTIK2jbiCwHuJ8bPoSfdytS58xRZpp UBBA== X-Gm-Message-State: AOAM533Jwqqfd+XGa0vko7R9nY/Svm2sg7WCcRmGDW86+qsG2v91dCto edYCVTGqbWcgtopVKOVbBnkK4CWSBIBc7SWsJPk= X-Google-Smtp-Source: ABdhPJxWBAHJvXmx92TJyJDSEvTIKGWGEUng3vk/iImzkp2jtDKRh5C1gX0xnCSTfB8KG2DcXwK4RAy3q90LdAw1mS0= X-Received: by 2002:a25:df8e:: with SMTP id w136mr26365744ybg.230.1607396024423; Mon, 07 Dec 2020 18:53:44 -0800 (PST) MIME-Version: 1.0 References: <20201201215900.3569844-1-guro@fb.com> <20201203032645.GB1568874@carbon.DHCP.thefacebook.com> <6abdd146-c584-9c66-261d-d7d39ff3f499@iogearbox.net> In-Reply-To: <6abdd146-c584-9c66-261d-d7d39ff3f499@iogearbox.net> From: Andrii Nakryiko Date: Mon, 7 Dec 2020 18:53:33 -0800 Message-ID: Subject: Re: [PATCH bpf-next v9 00/34] bpf: switch to memcg-based memory accounting To: Daniel Borkmann Cc: Roman Gushchin , Alexei Starovoitov , bpf , Alexei Starovoitov , Network Development , Andrii Nakryiko , Andrew Morton , linux-mm , LKML , Kernel Team Content-Type: text/plain; charset="UTF-8" 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, Dec 4, 2020 at 4:37 PM Daniel Borkmann wrote: > > On 12/3/20 4:26 AM, Roman Gushchin wrote: > > On Wed, Dec 02, 2020 at 06:54:46PM -0800, Alexei Starovoitov wrote: > >> On Tue, Dec 1, 2020 at 1:59 PM Roman Gushchin wrote: > >>> > >>> 5) Cryptic -EPERM is returned on exceeding the limit. Libbpf even had > >>> a function to "explain" this case for users. > >> ... > >>> v9: > >>> - always charge the saved memory cgroup, by Daniel, Toke and Alexei > >>> - added bpf_map_kzalloc() > >>> - rebase and minor fixes > >> > >> This looks great. Applied. > > > > Thanks! > > > >> Please follow up with a change to libbpf's pr_perm_msg(). > >> That helpful warning should stay for old kernels, but it would be > >> misleading for new kernels. > >> libbpf probably needs a feature check to make this warning conditional. > > > > I think we've discussed it several months ago and at that time we didn't > > find a good way to check this feature. I'll think again, but if somebody > > has any ideas here, I'll appreciate a lot. > > Hm, bit tricky, agree .. given we only throw the warning in pr_perm_msg() for > non-root and thus probing options are also limited, otherwise just probing for > a helper that was added in this same cycle would have been good enough as a > simple heuristic. I wonder if it would make sense to add some hint inside the > bpf_{prog,map}_show_fdinfo() to indicate that accounting with memcg is enabled I think the initial version was emitting 0 for memlock, so that was a pretty simple way to prove stuff. But I think it was changed at the last minute to emit some non-zero "estimate" of memory used or something like that? > for the prog/map one way or another? Not just for the sake of pr_perm_msg(), but > in general for apps to stop messing with rlimit at this point. Maybe also bpftool > feature probe could be extended to indicate that as well (e.g. the json output > can be fed into Go natively).