public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 4/7] objtool: reduce memory usage of struct reloc
       [not found] ` <20221216-objtool-memory-v1-4-6f2dd3ed7312@weissschuh.net>
@ 2022-12-19 10:52   ` Peter Zijlstra
  0 siblings, 0 replies; only message in thread
From: Peter Zijlstra @ 2022-12-19 10:52 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: Josh Poimboeuf, linux-kernel

On Sun, Dec 18, 2022 at 09:30:07PM +0000, Thomas Weißschuh wrote:
> Use a smaller type for the relocation type and move it to a location in
> the structure where it avoids wasted padding bytes.
> 
> Technically ELF could use up to four bytes for the type.
> But until now only types up to number 43 have been defined.
> 
> Reduce the size of struct reloc on x86_64 from 120 to 112 bytes.
> This structure is allocated a lot and never freed.

Please put in a assertion for this -- I can see this going sideways fast
if we ever get this wrong.

static inline void reloc_set_type(struct reloc *reloc, int type)
{
	if (type > (1U << (8*sizeof(reloc->type))))
		WARN_ELF("reloc->type out of range");

	reloc->type = type;
}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-19 10:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20221216-objtool-memory-v1-0-6f2dd3ed7312@weissschuh.net>
     [not found] ` <20221216-objtool-memory-v1-4-6f2dd3ed7312@weissschuh.net>
2022-12-19 10:52   ` [PATCH 4/7] objtool: reduce memory usage of struct reloc Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox