[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d7c27813-52b9-4f06-b501-8443f7215be7@wanadoo.fr>
Date: Tue, 29 Jul 2025 22:09:27 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: "Colin King (gmail)" <colin.i.king@...il.com>,
"James E . J . Bottomley" <James.Bottomley@...senPartnership.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
linux-scsi@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] scsi: scsi_debug: make read-only arrays static
const
Le 29/07/2025 à 21:49, Colin King (gmail) a écrit :
> On 29/07/2025 18:45, Christophe JAILLET wrote:
>> Le 29/07/2025 à 08:49, Colin Ian King a écrit :
>>> Don't populate the read-only arrays on the stack at run time, instead
>>> make them static const. Also reduces overall size.
>>>
>>> before:
>>> text data bss dec hex filename
>>> 367439 89582 5952 462973 7107d drivers/scsi/
>>> scsi_debug.o
>>>
>>> after:
>>> text data bss dec hex filename
>>> 365847 90702 5952 462501 70ea5 drivers/scsi/
>>> scsi_debug.o
>>
>> Hi,
>>
>> out of curiosity, any idea why 'data' increase?
>
> Because the arrays are being stored in the data section rather than on
> the stack.
Even when const is used?
See [1] for example, adding const moves the size from data to text.
I would expect the same with your patch.
CJ
[1]:
https://web.git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=86b0fc4b2b45a78cbdc11873bc596d140eff390c
>
>>
>> All my constification patches lead to data reduction.
>>
>>>
>>> (gcc 14.2.0, x86-64)
>>
>> (same kind of behavior with 15.1.1)
>>
>>
>> CJ
>
Powered by blists - more mailing lists