[PATCH] powerpc: ps3: mark ps3_notification_device static for stack usage

Geoff Levand geoff at infradead.org
Sun Mar 24 12:19:06 AEDT 2024


On 3/23/24 05:24, Arnd Bergmann wrote:
> On Fri, Mar 22, 2024, at 09:34, Geoff Levand wrote:
>> On 3/21/24 17:32, Geert Uytterhoeven wrote:
>>> --- a/arch/powerpc/platforms/ps3/device-init.c
>>>> +++ b/arch/powerpc/platforms/ps3/device-init.c
>>>> @@ -770,7 +770,7 @@ static struct task_struct *probe_task;
>>>>
>>>>  static int ps3_probe_thread(void *data)
>>>>  {
>>>> -       struct ps3_notification_device dev;
>>>> +       static struct ps3_notification_device dev;
>>>>         int res;
>>>>         unsigned int irq;
>>>>         u64 lpar;
>>>
>>> Making it static increases kernel size for everyone.  So I'd rather
>>> allocate it dynamically. The thread already allocates a buffer, which
>>> can be replaced at no cost by allocating a structure containing both
>>> the ps3_notification_device and the buffer.
> 
> I didn't think it mattered much, given that you would rarely
> have a kernel with PS3 support along with other platforms.
> 
> I suppose it does increase the size for a PS3-only kernel
> as well, while your version makes it smaller.
> 
>> Here's what I came up with.  It builds for me without warnings.
>> I haven't tested it yet.  A review would be appreciated.
> 
> It seems a little complicated but looks all correct to
> me and reduces both stack and .data size, so
> 
> Acked-by: Arnd Bergmann <arnd at arndb.de>

Thanks Arnd.  I also thought it was a bit too much.  I made a simpler
version that I'll post as a separate message.

-Geoff



More information about the Linuxppc-dev mailing list