On Thu, May 12, 2022 at 1:01 AM Paul Menzel <pmenzel@xxxxxxxxxxxxx> wrote: > > Dear Christoph, > > > Am 12.05.22 um 08:27 schrieb Christoph Hellwig: > > On Thu, May 12, 2022 at 08:25:28AM +0200, Paul Menzel wrote: > > >> Am 12.05.22 um 08:19 schrieb Christoph Hellwig: > >>> Use the %pg format specifier to save on stack consuption and code size. > >> > >> consu*m*ption > >> > >> Did you do any measurements? > > > > Each BDEVNAME_SIZE array consumes 32 bytes on the stack, and they are > > gone now without any additional stack usage elsewhere. > > Understood. > > For comparing the code size, out of curiosity, I built `drivers/md` from > md-next, commit 74fe94569da7 (md: protect md_unregister_thread from > reentrancy), without and with your patch with gcc 11.1.0, and got: > > ``` > $ diff -u <(cd drivers/md-before/ && du -a | sort -k2) <(cd drivers/md/ > && du -a | sort -k2) > --- /dev/fd/63 2022-05-12 09:51:23.354107016 +0200 > +++ /dev/fd/62 2022-05-12 09:51:23.355107064 +0200 > @@ -1,4 +1,4 @@ > -11064 . > +11052 . > 4 ./.built-in.a.cmd > 48 ./.dm-bio-prison-v1.o.cmd > 20 ./.dm-bio-prison-v1.o.d > @@ -287,7 +287,7 @@ > 24 ./md-multipath.o > 260 ./md.c > 28 ./md.h > -308 ./md.o > +304 ./md.o > 4 ./modules.order > 1380 ./persistent-data > 48 ./persistent-data/.dm-array.o.cmd > @@ -356,7 +356,7 @@ > 148 ./raid10.c > 8 ./raid10.h > 4 ./raid10.mod > -108 ./raid10.o > +104 ./raid10.o > 88 ./raid5-cache.c > 76 ./raid5-cache.o > 8 ./raid5-log.h > @@ -364,4 +364,4 @@ > 48 ./raid5-ppl.o > 252 ./raid5.c > 32 ./raid5.h > -212 ./raid5.o > +208 ./raid5.o > ``` > > > Kind regards, > > Paul Applied to md-next. Thanks! Song