lkml.org 
[lkml]   [2023]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [RFC 2/4] media: videobuf2: Replace bufs array by a list
Date
From: Laurent Pinchart
> Sent: 13 March 2023 18:12
>
> Hi Benjamin,
>
> Thank you for the patch.
>
> On Mon, Mar 13, 2023 at 02:59:14PM +0100, Benjamin Gaignard wrote:
> > Replacing bufs array by a list allows to remove the 32 buffers
> > limit per queue.

Is the limit actually a problem?
Arrays of pointers have locking and caching advantages over
linked lists.

...
> > @@ -1239,8 +1242,12 @@ static inline void vb2_clear_last_buffer_dequeued(struct vb2_queue *q)
> > static inline struct vb2_buffer *vb2_get_buffer(struct vb2_queue *q,
> > unsigned int index)
> > {
> > - if (index < q->num_buffers)
> > - return q->bufs[index];
> > + struct vb2_buffer *vb;
> > +
> > + list_for_each_entry(vb, &q->allocated_bufs, allocated_entry)
> > + if (vb->index == index)
> > + return vb;
> > +
> > return NULL;

You really don't want to be doing that....

There are schemes for unbounded arrays.
Scanning a linked list isn't a very good one.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
\
 
 \ /
  Last update: 2023-03-27 00:57    [W:1.359 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site