Re: [RFC bpf-next 0/3] tools: bpftool: add subcommand to count map entries

2019-08-16 Thread Edward Cree
On 15/08/2019 15:15, Quentin Monnet wrote: > So if I understand correctly, we would use the bpf() syscall to trigger > a run of such program on all map entries (for map implementing the new > operation), and the context would include pointers to the key and the > value for the entry being processed

Re: [RFC bpf-next 0/3] tools: bpftool: add subcommand to count map entries

2019-08-15 Thread Quentin Monnet
2019-08-14 18:14 UTC+0100 ~ Edward Cree > On 14/08/2019 17:58, Quentin Monnet wrote: >> 2019-08-14 17:45 UTC+0100 ~ Edward Cree >>> This might be a really dumb suggestion, but: you're wanting to collect a >>>  summary statistic over an in-kernel data structure in a single syscall, >>>  because ma

Re: [RFC bpf-next 0/3] tools: bpftool: add subcommand to count map entries

2019-08-15 Thread Quentin Monnet
2019-08-14 13:18 UTC-0700 ~ Andrii Nakryiko > On Wed, Aug 14, 2019 at 10:12 AM Quentin Monnet > wrote: >> >> 2019-08-14 09:58 UTC-0700 ~ Alexei Starovoitov >> >>> On Wed, Aug 14, 2019 at 9:45 AM Edward Cree wrote: On 14/08/2019 10:42, Quentin Monnet wrote: > 2019-08-13 18:51 UTC-0

Re: [RFC bpf-next 0/3] tools: bpftool: add subcommand to count map entries

2019-08-14 Thread Andrii Nakryiko
On Wed, Aug 14, 2019 at 10:12 AM Quentin Monnet wrote: > > 2019-08-14 09:58 UTC-0700 ~ Alexei Starovoitov > > > On Wed, Aug 14, 2019 at 9:45 AM Edward Cree wrote: > >> > >> On 14/08/2019 10:42, Quentin Monnet wrote: > >>> 2019-08-13 18:51 UTC-0700 ~ Alexei Starovoitov > >>> > The same can

Re: [RFC bpf-next 0/3] tools: bpftool: add subcommand to count map entries

2019-08-14 Thread Edward Cree
On 14/08/2019 17:58, Quentin Monnet wrote: > 2019-08-14 17:45 UTC+0100 ~ Edward Cree >> This might be a really dumb suggestion, but: you're wanting to collect a >>  summary statistic over an in-kernel data structure in a single syscall, >>  because making a series of syscalls to examine every entr

Re: [RFC bpf-next 0/3] tools: bpftool: add subcommand to count map entries

2019-08-14 Thread Quentin Monnet
2019-08-14 09:58 UTC-0700 ~ Alexei Starovoitov > On Wed, Aug 14, 2019 at 9:45 AM Edward Cree wrote: >> >> On 14/08/2019 10:42, Quentin Monnet wrote: >>> 2019-08-13 18:51 UTC-0700 ~ Alexei Starovoitov >>> The same can be achieved by 'bpftool map dump|grep key|wc -l', no? >>> To some extent (

Re: [RFC bpf-next 0/3] tools: bpftool: add subcommand to count map entries

2019-08-14 Thread Quentin Monnet
2019-08-14 17:45 UTC+0100 ~ Edward Cree > On 14/08/2019 10:42, Quentin Monnet wrote: >> 2019-08-13 18:51 UTC-0700 ~ Alexei Starovoitov >> >>> The same can be achieved by 'bpftool map dump|grep key|wc -l', no? >> To some extent (with subtleties for some other map types); and we use a >> similar co

Re: [RFC bpf-next 0/3] tools: bpftool: add subcommand to count map entries

2019-08-14 Thread Alexei Starovoitov
On Wed, Aug 14, 2019 at 9:45 AM Edward Cree wrote: > > On 14/08/2019 10:42, Quentin Monnet wrote: > > 2019-08-13 18:51 UTC-0700 ~ Alexei Starovoitov > > > >> The same can be achieved by 'bpftool map dump|grep key|wc -l', no? > > To some extent (with subtleties for some other map types); and we us

Re: [RFC bpf-next 0/3] tools: bpftool: add subcommand to count map entries

2019-08-14 Thread Edward Cree
On 14/08/2019 10:42, Quentin Monnet wrote: > 2019-08-13 18:51 UTC-0700 ~ Alexei Starovoitov > >> The same can be achieved by 'bpftool map dump|grep key|wc -l', no? > To some extent (with subtleties for some other map types); and we use a > similar command line as a workaround for now. But because

Re: [RFC bpf-next 0/3] tools: bpftool: add subcommand to count map entries

2019-08-14 Thread Quentin Monnet
2019-08-13 18:51 UTC-0700 ~ Alexei Starovoitov > On Tue, Aug 13, 2019 at 02:09:18PM +0100, Quentin Monnet wrote: >> This series adds a "bpftool map count" subcommand to count the number of >> entries present in a BPF map. This results from a customer request for a >> tool to count the number of en

Re: [RFC bpf-next 0/3] tools: bpftool: add subcommand to count map entries

2019-08-13 Thread Alexei Starovoitov
On Tue, Aug 13, 2019 at 02:09:18PM +0100, Quentin Monnet wrote: > This series adds a "bpftool map count" subcommand to count the number of > entries present in a BPF map. This results from a customer request for a > tool to count the number of entries in BPF maps used in production (for > example,

[RFC bpf-next 0/3] tools: bpftool: add subcommand to count map entries

2019-08-13 Thread Quentin Monnet
This series adds a "bpftool map count" subcommand to count the number of entries present in a BPF map. This results from a customer request for a tool to count the number of entries in BPF maps used in production (for example, to know how many free entries are left in a given map). The first two c