public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/7] objtool: reduce memory usage of struct reloc
Date: Mon, 19 Dec 2022 11:52:03 +0100	[thread overview]
Message-ID: <Y6BCU+vGYV7GVl4c@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20221216-objtool-memory-v1-4-6f2dd3ed7312@weissschuh.net>

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;
}


           reply	other threads:[~2022-12-19 10:52 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20221216-objtool-memory-v1-4-6f2dd3ed7312@weissschuh.net>]

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=Y6BCU+vGYV7GVl4c@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    /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