All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Mackall <mpm-VDJrAJ4Gl5ZBDgjK7y7TUQ@public.gmane.org>
To: sukadev-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org
Cc: Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>,
	Pavel Emelianov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
Subject: Re: Kernel text size with pid namespace
Date: Wed, 19 Sep 2007 22:39:45 -0500	[thread overview]
Message-ID: <20070920033945.GM4219@waste.org> (raw)
In-Reply-To: <20070920001644.GA14880-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

On Wed, Sep 19, 2007 at 05:16:44PM -0700, sukadev-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org wrote:
> Matt,
> 
> The pid-namespace patcheset (http://lkml.org/lkml/2007/8/10/118)
> was added to the -mm tree in 2.6.23-rc3-mm1.
> 
> With CONFIG_CC_OPTIMIZE_FOR_SIZE=y this patchset increases the kernel
> text size by about 5K (closer to 6K when the config token is set to N).

That's not too bad.
 
> As a quick test, I uninlined several helper functions and with this
> the text size increased by about 4K. But since most of these inline
> functions are used in process creation/termination, we would need to
> keep them inline, when optimizing for performance.

You are aware that functions as critical as spinlocks are now
completely out of line, right? Given that a cache miss is
significantly more expensive than a function call, fitting more in
cache by reducing inlining tends to be a substantial win.

Inline functions still tend to make performance sense when the actual
function body is more complex than setting up the call frame, of
course, but in those cases, uninlining will tend to increase code
size.

But I'd be very surprised if uninlining things showed up negatively
even on a microbenchmark like lmbench.

Also, quick question (I haven't really looked at this code in any detail):

 static inline pid_t pid_nr(struct pid *pid)
 {
	pid_t nr = 0;
	if (pid)
-	   nr = pid->nr;
+	      nr = pid->numbers[0].nr;
+	      return nr;
+}

Is calling this with a null struct pid a sensible thing to do or is it
a bug? If the latter, it'd be preferable to just do:

	return pid->numbers[0].nr;

And if the former, could we arrange to avoid using null struct pids at
all? Perhaps by having a dummy zeropid?

> Is there a cause for concern with the 5K to 6K increase in text size ?
> If so, can/should we conditionally inline some functions ? Or move 
> some pid namespace creation code under CONFIG_TINY or something ?
> Are there other techniques besides uninling we could apply ?
> 
> For reference, I am including below, some numbers for 2.6.23-rc2-mm2
> kernel for an x86_64 config file.  In the following filenames:
> 
> 	"clean" 	no pid ns patches
> 	"opt-size"	CONFIG_CC_OPTIMIZE_FOR_SIZE=y
> 	"no-opt"	CONFIG_CC_OPTIMIZE_FOR_SIZE=n
> 	"uninline"	uninline several new inline functions.
> 
> $ size vmlinux*
> 
>    text    data     bss     dec     hex filename
> 
> 6016101  906266  772424 7694791  7569c7 vmlinux-clean-no-opt-size
> 6021869  906330  772424 7700623  75808f vmlinux-pidns-no-opt-size
> 6020805  906330  772424 7699559  757c67 vmlinux-pidns-no-opt-uninline-task-pid
> 
> 5299192  906330  772424 6977946  6a799a vmlinux-clean-opt-size
> 5304588  906394  772424 6983406  6a8eee vmlinux-pidns-opt-size
> 5303348  906394  772424 6982166  6a8a16 vmlinux-pidns-opt-size-uninline-task-pid

You might try running scripts/bloat-o-meter against a pair of these.

-- 
Mathematics is the supreme nostalgia of our time.

  parent reply	other threads:[~2007-09-20  3:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-20  0:16 Kernel text size with pid namespace sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found] ` <20070920001644.GA14880-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-09-20  3:39   ` Matt Mackall [this message]
     [not found]     ` <20070920033945.GM4219-1tnLUEbcrg3YtjvyW6yDsg@public.gmane.org>
2007-09-21  5:03       ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]         ` <20070921050359.GA1416-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-09-21 15:15           ` Matt Mackall
2007-09-20  9:13   ` Pavel Emelyanov
     [not found]     ` <46F239B2.8080500-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-09-20 11:04       ` Paul Jackson
     [not found]         ` <20070920040406.57e40ece.pj-sJ/iWh9BUns@public.gmane.org>
2007-09-20 11:55           ` Pavel Emelyanov
2007-09-21 11:31       ` Carl-Daniel Hailfinger

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=20070920033945.GM4219@waste.org \
    --to=mpm-vdjraj4gl5zbdgjk7y7tuq@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=sukadev-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.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.