mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
reduce large do_mount stack usage with noinlines
do_mount() uses a whopping 616 bytes of stack on x86_64 in 2.6.24-mm1, largely thanks to gcc inlining the various helper functions. noinlining these can slim it down a lot; on my box this patch gets it down to 168, which is mostly the struct nameidata nd; left on the stack. These functions are called only as do_mount() helpers; none of them should be in any path that would see a performance benefit from inlining... Signed-off-by: Eric Sandeen <sandeen@redhat.com> Cc: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
ac2a659968
commit
2dafe1c4d6
@ -936,8 +936,9 @@ out_unlock:
|
||||
|
||||
/*
|
||||
* recursively change the type of the mountpoint.
|
||||
* noinline this do_mount helper to save do_mount stack space.
|
||||
*/
|
||||
static int do_change_type(struct nameidata *nd, int flag)
|
||||
static noinline int do_change_type(struct nameidata *nd, int flag)
|
||||
{
|
||||
struct vfsmount *m, *mnt = nd->mnt;
|
||||
int recurse = flag & MS_REC;
|
||||
@ -960,8 +961,10 @@ static int do_change_type(struct nameidata *nd, int flag)
|
||||
|
||||
/*
|
||||
* do loopback mount.
|
||||
* noinline this do_mount helper to save do_mount stack space.
|
||||
*/
|
||||
static int do_loopback(struct nameidata *nd, char *old_name, int recurse)
|
||||
static noinline int do_loopback(struct nameidata *nd, char *old_name,
|
||||
int recurse)
|
||||
{
|
||||
struct nameidata old_nd;
|
||||
struct vfsmount *mnt = NULL;
|
||||
@ -1010,8 +1013,9 @@ out:
|
||||
* change filesystem flags. dir should be a physical root of filesystem.
|
||||
* If you've mounted a non-root directory somewhere and want to do remount
|
||||
* on it - tough luck.
|
||||
* noinline this do_mount helper to save do_mount stack space.
|
||||
*/
|
||||
static int do_remount(struct nameidata *nd, int flags, int mnt_flags,
|
||||
static noinline int do_remount(struct nameidata *nd, int flags, int mnt_flags,
|
||||
void *data)
|
||||
{
|
||||
int err;
|
||||
@ -1046,7 +1050,10 @@ static inline int tree_contains_unbindable(struct vfsmount *mnt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_move_mount(struct nameidata *nd, char *old_name)
|
||||
/*
|
||||
* noinline this do_mount helper to save do_mount stack space.
|
||||
*/
|
||||
static noinline int do_move_mount(struct nameidata *nd, char *old_name)
|
||||
{
|
||||
struct nameidata old_nd, parent_nd;
|
||||
struct vfsmount *p;
|
||||
@ -1121,8 +1128,9 @@ out:
|
||||
/*
|
||||
* create a new mount for userspace and request it to be added into the
|
||||
* namespace's tree
|
||||
* noinline this do_mount helper to save do_mount stack space.
|
||||
*/
|
||||
static int do_new_mount(struct nameidata *nd, char *type, int flags,
|
||||
static noinline int do_new_mount(struct nameidata *nd, char *type, int flags,
|
||||
int mnt_flags, char *name, void *data)
|
||||
{
|
||||
struct vfsmount *mnt;
|
||||
|
Loading…
Reference in New Issue
Block a user