2021-08-04 20:46:09

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [PATCH v1] driver: base: Add driver filter support

On Wed, Aug 04, 2021 at 10:43:22AM -0700, Kuppuswamy Sathyanarayanan wrote:
> +/* Driver allow list */
> +static LIST_HEAD(driver_allow_list);
> +/* Driver deny list */
> +static LIST_HEAD(driver_deny_list);

Why use a doubly-linked-list here? An allocating xarray should perform
much better and use less memory.


Subject: Re: [PATCH v1] driver: base: Add driver filter support



On 8/4/21 11:08 AM, Matthew Wilcox wrote:
> Why use a doubly-linked-list here? An allocating xarray should perform
> much better and use less memory.

We don't expect the list to be too long. So we may not gain any significant
advantage in terms of performance or memory when using alternate lists. Since
linked list easier to use, we chose it.

--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer

2021-08-04 20:54:28

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [PATCH v1] driver: base: Add driver filter support

On Wed, Aug 04, 2021 at 11:29:31AM -0700, Kuppuswamy, Sathyanarayanan wrote:
>
>
> On 8/4/21 11:08 AM, Matthew Wilcox wrote:
> > Why use a doubly-linked-list here? An allocating xarray should perform
> > much better and use less memory.
>
> We don't expect the list to be too long. So we may not gain any significant
> advantage in terms of performance or memory when using alternate lists. Since
> linked list easier to use, we chose it.

It is not easier to use.

2021-08-04 21:04:20

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH v1] driver: base: Add driver filter support

On Wed, Aug 4, 2021 at 11:09 AM Matthew Wilcox <[email protected]> wrote:
>
> On Wed, Aug 04, 2021 at 10:43:22AM -0700, Kuppuswamy Sathyanarayanan wrote:
> > +/* Driver allow list */
> > +static LIST_HEAD(driver_allow_list);
> > +/* Driver deny list */
> > +static LIST_HEAD(driver_deny_list);
>
> Why use a doubly-linked-list here? An allocating xarray should perform
> much better and use less memory.

Sounds reasonable to me.

2021-08-05 01:38:39

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH v1] driver: base: Add driver filter support


On 8/4/2021 11:29 AM, Kuppuswamy, Sathyanarayanan wrote:
>
>
> On 8/4/21 11:08 AM, Matthew Wilcox wrote:
>> Why use a doubly-linked-list here?  An allocating xarray should perform
>> much better and use less memory.
>
> We don't expect the list to be too long. So we may not gain any
> significant
> advantage in terms of performance or memory when using alternate
> lists. Since
> linked list easier to use, we chose it.
>
Also even if it was long it wouldn't matter because this isn't a fast
path at all.

All that matters it to write the code as clearly as possible.

-Andi