Hi Ralf, On Monday, 12 June 2017 01:27:42 PDT Ralf Baechle wrote: > On Fri, Jun 09, 2017 at 05:26:32PM -0700, Paul Burton wrote: > > This series makes a bunch of cleanups & improvements to the cmpxchg() & > > xchg() macros & functions, allowing them to be used on values smaller > > than 4 bytes, then switches MIPS over to use generic queued spinlocks & > > queued read/write locks. > > A number of nice cleanups there! Thanks! > I'm wondering, have you tested the kernel size with and without this > series applied? GCC claims since 25 years or so that inlines are as > efficient as macros but in reality macros have always been superior > which mattered for things that are expanded very often. > > More recent GCCs have claimed improvments so it'd be interested to see > actual numbers - and possibly get rid of many more unmaintainable macros. If I build a pistachio_defconfig v4.12-rc4 kernel, with ftrace disabled (same config mentioned in the 2 locking patches) and with my "MIPS: Hardcode cpu_has_* where known at compile time due to ISA" patch applied in all cases then I see: Configuration | Size --------------------------------|--------- v4.12-rc4 | 7161133 v4.12-rc4 + cmpxchg cleanups | 7165597 v4.12-rc4 + whole series | 7166600 The cmpxchg cleanups row applies patches 1-9 of this series but leaves off the 2 queued locking patches, so is a direct look at just the cmpxchg/xchg changes. Sizes are as reported by scripts/bloat-o-meter. The toolchain used was Codescape 2016.05-06 (gcc 4.9.2, binutils 2.24.90) as found here: http://codescape-mips-sdk.imgtec.com/components/toolchain/2016.05-06/ So the cmpxchg patches cost us 4464 bytes, of which __cmpxchg_small() & __xchg_small() make up 444 bytes: function old new delta __cmpxchg_small - 236 +236 __xchg_small - 208 +208 The rest is all small changes one way or the other to various functions throughout the tree, making up a little under 4KiB cost to the cmpxchg() & xchg() cleanups. Not zero (which actually surprises me..!) but hopefully not too much. The generic queued locks then cost us a further ~1KiB but I'd argue offer enough benefits to outweigh that (if nothing else look at asm/spinlock.h afterwards :p). Thanks, Paul
Attachment:
signature.asc
Description: This is a digitally signed message part.