All of lore.kernel.org
 help / color / mirror / Atom feed
From: moosotc@gmail.com
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] objtool: Move objtool_file struct off the stack
Date: Thu, 14 Mar 2019 18:31:37 +0300	[thread overview]
Message-ID: <87mulxxyjq.fsf@gmail.com> (raw)
In-Reply-To: <183fac0cca806ab54b0709ed0eb94aa2e86fdc24.1552577139.git.jpoimboe@redhat.com> (Josh Poimboeuf's message of "Thu, 14 Mar 2019 10:25:58 -0500")

Josh Poimboeuf <jpoimboe@redhat.com> writes:

> Objtool uses over 512k of stack, thanks to the hash table embedded in
> the objtool_file struct.  This causes an unnecessarily large stack
> allocation and breaks users with low stack limits.
>
> Move the struct off the stack.
>
> Fixes: 042ba73fe7eb ("objtool: Add several performance improvements")
> Reported-by: Vassili Karpov <moosotc@gmail.com>
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
>  tools/objtool/check.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index 0414a0d52262..91c4799192e1 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -2184,9 +2184,10 @@ static void cleanup(struct objtool_file *file)
>  	elf_close(file->elf);
>  }
>  
> +struct objtool_file file;
> +

Maybe it also deserves a "static" storage duration (if nothing else this
would prevent possible name clashes)?

>  int check(const char *_objname, bool orc)
>  {
> -	struct objtool_file file;
>  	int ret, warnings = 0;
>  
>  	objname = _objname;

-- 
mailto:moosotc@gmail.com

  reply	other threads:[~2019-03-14 15:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14 15:25 [PATCH] objtool: Move objtool_file struct off the stack Josh Poimboeuf
2019-03-14 15:31 ` moosotc [this message]
2019-03-14 16:15   ` Josh Poimboeuf

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=87mulxxyjq.fsf@gmail.com \
    --to=moosotc@gmail.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.