mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Kennedy <richard@rsk.demon.co.uk>
To: lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] [RFC] shrink struct pid by removing padding on 64 bit builds
Date: Sun, 11 May 2008 16:29:36 +0100	[thread overview]
Message-ID: <1210519776.2958.34.camel@castor.localdomain> (raw)

When struct pid is built on a 64 bit platform gcc has to insert padding
to maintain the correct alignment, by simply reordering its members the
memory usage shrinks from 88 bytes to 80.

I've successfully run with this patch on my desktop AMD64 machine.

There are no significant kernel size changes to a default config.X86_64
on the latest git v2.6.26-rc1

   text    data     bss     dec     hex filename
5404828  976760  734280 7115868  6c945c vmlinux
5404811  976760  734280 7115851  6c944b vmlinux.pid-patch

The question really is : Is it safe to make this change?

I haven't spotted anywhere that depends on the exact layout of the pid
structure, but there's a lot of code to review & I haven't gone though
it all in detail.
struct pid doesn't appear in the user headers, so isn't exposed to user
space. So I think it will be safe.

Any ideas ?

Thanks
Richard

diff --git a/include/linux/pid.h b/include/linux/pid.h
index c21c7e8..6f084b9 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -57,10 +57,10 @@ struct upid {
 struct pid
 {
 	atomic_t count;
+	unsigned int level;
 	/* lists of tasks that use this pid */
 	struct hlist_head tasks[PIDTYPE_MAX];
 	struct rcu_head rcu;
-	unsigned int level;
 	struct upid numbers[1];
 };
 



                 reply	other threads:[~2008-05-11 15:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1210519776.2958.34.camel@castor.localdomain \
    --to=richard@rsk.demon.co.uk \
    --cc=linux-kernel@vger.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®