Re: [PATCH v4 bpf-next 6/6] selftests/bpf: check that ->elem_count is non-zero for the hash map

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 6, 2023 at 11:34 AM Anton Protopopov <aspsk@xxxxxxxxxxxxx> wrote:
>
> On Thu, Jul 06, 2023 at 10:48:16AM -0700, Alexei Starovoitov wrote:
> > On Thu, Jul 6, 2023 at 10:42 AM Anton Protopopov <aspsk@xxxxxxxxxxxxx> wrote:
> > >
> > > >
> > > > Don't you want to do:
> > > >  val = bpf_map_lookup_elem(map, ...);
> > > >  cnt = bpf_map_sum_elem_count(map);
> > > >
> > > > and that's the main use case ?
> > >
> > > Not sure I understand what this ^ use case is...
> > >
> > > Our primary use case is to [periodically] get the number of elements from the
> > > user space. We can do this using an iterator as you've suggested and what is
> > > tested in the added selftest.
> >
> > Hmm. During the last office hours John explained that he needs to raise
> > alarm to user space when the map is close to full capacity.
> > Currently he's doing it with his own per-map counters implemented
> > in a bpf prog.
> > I'd expect the alarm to be done inline with updates to the counters.
> > If you scan maps from user space every second or so there is a chance
> > the spike in usage will be missed.
> >
> > If we're adding map counters they should be usable not only via iterators.
>
> In some use cases this is ok to miss a spike in favour of not checking counters
> too often. But yes, for other use cases this makes sense to add support for
> const map ptr, so I will do this.

Great. Please send a follow up.
I've applied the current set.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux