public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: rae l <crquan@gmail.com>
Cc: linux-kernel@vger.kernel.org, ebiederm@xmission.com
Subject: Re: Since sysfs_mount is static and used only in sysfs_init function, it could be just an automatic variable.
Date: Sat, 1 Dec 2007 23:54:37 -0800	[thread overview]
Message-ID: <20071202075437.GA19897@suse.de> (raw)
In-Reply-To: <91b13c310712012252k5307735x782582fd2d7abd94@mail.gmail.com>

On Sun, Dec 02, 2007 at 02:52:17PM +0800, rae l wrote:
> On Dec 2, 2007 12:48 PM, Greg KH <gregkh@suse.de> wrote:
> ...
> > > and where is a detailed explaination on kern_mount? could someone give
> > > some comments or documentation pointers on this?
> >
> > See the patches that Eric Biederman just posted to lkml for why this
> > structure is a static pointer this way right now, it's in preparation
> > for future patches.
> I have checked commit 7d0c7d676cc066413e1583b5af9fba8011972d41 by Eric
> W. Biederman,
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=7d0c7d676cc066413e1583b5af9fba8011972d41
> 
> which just make sysfs_mount from externally visible to static that
> could be only used in one c file,
> 
> but I mean that the static variable is still on kernel bss section,
> this consumes a pointer (4 or 8 bytes) memory,
> 
> through a grep from fs/sysfs/, it appears that the variable
> sysfs_mount is only used in the sysfs_init function,
> 
> $ grep -RsInw sysfs_mount fs/sysfs/
> fs/sysfs/mount.c:25:static struct vfsmount *sysfs_mount;
> fs/sysfs/mount.c:101:           sysfs_mount = kern_mount(&sysfs_fs_type);
> fs/sysfs/mount.c:102:           if (IS_ERR(sysfs_mount)) {
> fs/sysfs/mount.c:104:                   err = PTR_ERR(sysfs_mount);
> fs/sysfs/mount.c:105:                   sysfs_mount = NULL;
> 
> we could mark this variable an automatic one, which scope is just in
> this function, thus created and destroyed with the stack,
> this approach does not consume a pointer on kernel bss section,
> 
> Why not do this?

Again, see the patches he _just_ posted to lkml, the specific message
you are looking for is:
	Message-ID: <m11wa693t0.fsf@ebiederm.dsl.xmission.com>
	Subject: [PATCH 01/10] sysfs: Make sysfs_mount static again.

Also see the whole long thread for more details.

If you have further questions about this, please ask Eric.

thanks,

greg k-h

  reply	other threads:[~2007-12-02  7:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-01 20:31 Since sysfs_mount is static and used only in sysfs_init function, it could be just an automatic variable rae l
2007-12-02  4:48 ` Greg KH
2007-12-02  6:52   ` rae l
2007-12-02  7:54     ` Greg KH [this message]
2007-12-02 22:22       ` Eric W. Biederman
2007-12-02 22:53         ` Greg KH
2007-12-03  0:46           ` Kay Sievers
2007-12-03  1:33             ` Eric W. Biederman

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=20071202075437.GA19897@suse.de \
    --to=gregkh@suse.de \
    --cc=crquan@gmail.com \
    --cc=ebiederm@xmission.com \
    --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