public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	"James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] scsi: scsi_debug: make read-only arrays static const
Date: Tue, 29 Jul 2025 20:49:07 +0100	[thread overview]
Message-ID: <64ec6c5e-5eb3-4db8-9540-7679ac694c11@gmail.com> (raw)
In-Reply-To: <86f359c3-8eb6-4fd7-8411-12d12e301d61@wanadoo.fr>


[-- Attachment #1.1.1: Type: text/plain, Size: 1006 bytes --]

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.

> 
> All my constification patches lead to data reduction.
> 
>>
>> (gcc 14.2.0, x86-64)
> 
> (same kind of behavior with 15.1.1)
> 
> 
> CJ


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 4901 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2025-07-29 19:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29  6:49 [PATCH][next] scsi: scsi_debug: make read-only arrays static const Colin Ian King
2025-07-29 16:02 ` Bart Van Assche
2025-07-29 17:45 ` Christophe JAILLET
2025-07-29 19:49   ` Colin King (gmail) [this message]
2025-07-29 20:09     ` Christophe JAILLET
2025-07-31  3:27 ` Martin K. Petersen
2025-08-06  2:39 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64ec6c5e-5eb3-4db8-9540-7679ac694c11@gmail.com \
    --to=colin.i.king@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox