Re: [PATCH 1/4] gpio: Remove VLA from gpiolib
From: Lukas Wunner
Date: Tue Mar 27 2018 - 23:55:03 EST
On Tue, Mar 27, 2018 at 05:37:18PM -0700, Laura Abbott wrote:
> On 03/18/2018 07:23 AM, Lukas Wunner wrote:
> > Actually, scratch that. If ngpio is usually smallish, we can just
> > allocate reasonably sized space for mask and bits on the stack,
> > and fall back to the kcalloc slowpath only if chip->ngpio exceeds
> > that limit. Basically the below (likewise compile-tested only),
> > this is on top of Laura's patch, could be squashed together.
> > Let me know what you think, thanks.
> >
>
> It seems like there's general consensus this is okay so I'm going
> to fold it into the next version. If not, we can discuss again.
Yes, feel free to squash into your original patch with my S-o-b,
keep your authorship.
You may want to raise FASTPATH_NGPIO to something like 384, 448 or 512
to accommodate for the Intel chips Andy mentioned. It's kind of a
"640k should be enough for everyone" thing but I'd expect the performance
impact of the extra bytes on the stack / memsetting them to zero
to be absolutely negligible.
Thanks!
Lukas