Re: [PATCH bpf-next 1/2] bpf: Add bits iterator

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

 



On Mon, Feb 26, 2024 at 3:21 PM John Fastabend <john.fastabend@xxxxxxxxx> wrote:
> > +__bpf_kfunc int *bpf_iter_bits_next(struct bpf_iter_bits *it)
> > +{
> > +     struct bpf_iter_bits_kern *kit = (void *)it;
> > +     const unsigned long *bits = kit->bits;
> > +     int bit;
> > +
> > +     if (!bits)
> > +             return NULL;
> > +
> > +     bit = find_next_bit(bits, kit->nr_bits, kit->bit + 1);
>
> Seems like this should be ok over unsafe memory as long as find_next_bit
> is bounded?

Are you proposing to add find_next_bit() as a kfunc instead?

With the bpf_can_loop() proposal these two can be combined and
it will probably achieve the same result.
But imo this iterator is small enough to get in now and
delete later when there is a better way.
Ideally we'd need to add new instructions to operate with bits efficiently.





[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