Thread (88 messages) 88 messages, 5 authors, 2020-07-30

Re: [PATCH bpf-next v2 27/35] bpf: eliminate rlimit-based memory accounting infra for bpf maps

From: Roman Gushchin <hidden>
Date: 2020-07-28 19:09:21
Also in: bpf, lkml

On Mon, Jul 27, 2020 at 11:06:42PM -0700, Song Liu wrote:
On Mon, Jul 27, 2020 at 10:58 PM Andrii Nakryiko
[off-list ref] wrote:
quoted
On Mon, Jul 27, 2020 at 10:47 PM Song Liu [off-list ref] wrote:
quoted
On Mon, Jul 27, 2020 at 12:26 PM Roman Gushchin [off-list ref] wrote:
quoted
Remove rlimit-based accounting infrastructure code, which is not used
anymore.

Signed-off-by: Roman Gushchin <redacted>
[...]
quoted
 static void bpf_map_put_uref(struct bpf_map *map)
@@ -541,7 +484,7 @@ static void bpf_map_show_fdinfo(struct seq_file *m, struct file *filp)
                   "value_size:\t%u\n"
                   "max_entries:\t%u\n"
                   "map_flags:\t%#x\n"
-                  "memlock:\t%llu\n"
+                  "memlock:\t%llu\n" /* deprecated */
I am not sure whether we can deprecate this one.. How difficult is it
to keep this statistics?
It's factually correct now, that BPF map doesn't use any memlock memory, no?
Right.
I am not sure whether memlock really means memlock for all users... I bet there
are users who use memlock to check total memory used by the map.
But this is just the part of struct bpf_map, so I agree with Andrii,
it's a safe check.
quoted
This is actually one way to detect whether RLIMIT_MEMLOCK is necessary
or not: create a small map, check if it's fdinfo has memlock: 0 or not
:)
If we do show memlock=0, this is a good check...
The only question I have if it's worth checking at all? Bumping the rlimit
is a way cheaper operation than creating a temporarily map and checking its
properties.

So is there any win in comparison to just leaving the userspace code* as it is
for now?

* except runqslower and samples
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help