Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp807299pxu; Fri, 4 Dec 2020 16:40:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxGma8BRCKkGirOI9/kEbu0wdX3QOSPD11QtU15oZ9W9W2u6ahIK16EbhWnoQx836jXRxO X-Received: by 2002:a17:906:26c6:: with SMTP id u6mr9405877ejc.349.1607128847034; Fri, 04 Dec 2020 16:40:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607128847; cv=none; d=google.com; s=arc-20160816; b=TlVYzEgHp4rojD1AbTq6cD8QqMpmszwr3zt5KBFXO56ZvUuu8846oCGNcNBKNUom0r OUDZRsYD6olB8PyeW0KuLuZ71tmkdzwVyV5pwyWZl1bLw4bigZWlbwdl4h9NLDqMOEBZ V23mTEG3UoqxebshWagXVXXPkJfpy57DPWX/YyASQirlvoz6fyc2HnwLLDhyHtXrBmy0 SzYHaYvYemXdpbkcpNI4iDuakWNDDoeJlUHbveH/i4gLvBoBSVbTvNNBY2W14fUZOix+ iNUftnfXal1rQGJ12C27u1lqGyHNl1xlYCtpzY17/5BJaTgNcKUFN2XZPTQ/UnNdzfl2 8UrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Pl9tpUCXB3J7kwtkp+49xqeecoD/C2O9GX9DhXKMw68=; b=mLmrKvV3bGO4YDl+L+dCIXMMqmlPYygoXDE+oBkqFpMYyWqarCcDeIdYRyLsZoWVf3 Yb5Gk/rUdekrgAUSFk5guz6F9GBN3DC5IsfecHAC6A83eD6OWTb+qDioj+hfNyzDXKTc zPUnLcJa9sbwG2yMd08XHL5wG55BiiMqqru2dVZcpy+0tjCUMVYVLh+nHFg6fA3vL2gF 7y4Z7LN4thzpnpYjglt6DjngJSnkxoeys0EI5uZBqH47+n0CMMpfss4Fl8JC8EgQAus9 gLu7UZJU4rZqgXZbTDpkcD2wzNVPGKysEBa0eBuMbhxlwfsbrR5wAIxBv2a9ywHhamgg nbVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zh18si2371168ejb.624.2020.12.04.16.40.23; Fri, 04 Dec 2020 16:40:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727012AbgLEAh7 (ORCPT + 99 others); Fri, 4 Dec 2020 19:37:59 -0500 Received: from www62.your-server.de ([213.133.104.62]:40872 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726070AbgLEAh7 (ORCPT ); Fri, 4 Dec 2020 19:37:59 -0500 Received: from sslproxy01.your-server.de ([78.46.139.224]) by www62.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1klLZc-0002yZ-00; Sat, 05 Dec 2020 01:37:16 +0100 Received: from [85.7.101.30] (helo=pc-9.home) by sslproxy01.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1klLZb-0009Y1-OG; Sat, 05 Dec 2020 01:37:15 +0100 Subject: Re: [PATCH bpf-next v9 00/34] bpf: switch to memcg-based memory accounting To: Roman Gushchin , Alexei Starovoitov Cc: bpf , Alexei Starovoitov , Network Development , Andrii Nakryiko , Andrew Morton , linux-mm , LKML , Kernel Team References: <20201201215900.3569844-1-guro@fb.com> <20201203032645.GB1568874@carbon.DHCP.thefacebook.com> From: Daniel Borkmann Message-ID: <6abdd146-c584-9c66-261d-d7d39ff3f499@iogearbox.net> Date: Sat, 5 Dec 2020 01:37:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20201203032645.GB1568874@carbon.DHCP.thefacebook.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.102.4/26008/Fri Dec 4 23:08:33 2020) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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).