mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: moosotc@gmail.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 11:15:03 -0500	[thread overview]
Message-ID: <20190314161503.67ti3ikrw6uydcqd@treble> (raw)
In-Reply-To: <87mulxxyjq.fsf@gmail.com>

On Thu, Mar 14, 2019 at 06:31:37PM +0300, moosotc@gmail.com wrote:
> 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)?

Yeah, good point.

> 
> >  int check(const char *_objname, bool orc)
> >  {
> > -	struct objtool_file file;
> >  	int ret, warnings = 0;
> >  
> >  	objname = _objname;
> 
> -- 
> mailto:moosotc@gmail.com

-- 
Josh

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

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

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=20190314161503.67ti3ikrw6uydcqd@treble \
    --to=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=moosotc@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®