aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2008-02-08 07:22:12 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:44 -0500
commit2dafe1c4d69345539735cca64250f2d4657bd057 (patch)
treea156663f7963869b6f4d6cd4afcc141064fc0329
parentac2a659968f5318a180213f0409c2ea21f072820 (diff)
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>
-rw-r--r--fs/namespace.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index db51ddc9b671..63ced21c12dc 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -936,8 +936,9 @@ out_unlock:
936 936
937/* 937/*
938 * recursively change the type of the mountpoint. 938 * recursively change the type of the mountpoint.
939 * noinline this do_mount helper to save do_mount stack space.
939 */ 940 */
940static int do_change_type(struct nameidata *nd, int flag) 941static noinline int do_change_type(struct nameidata *nd, int flag)
941{ 942{
942 struct vfsmount *m, *mnt = nd->mnt; 943 struct vfsmount *m, *mnt = nd->mnt;
943 int recurse = flag & MS_REC; 944 int recurse = flag & MS_REC;
@@ -960,8 +961,10 @@ static int do_change_type(struct nameidata *nd, int flag)
960 961
961/* 962/*
962 * do loopback mount. 963 * do loopback mount.
964 * noinline this do_mount helper to save do_mount stack space.
963 */ 965 */
964static int do_loopback(struct nameidata *nd, char *old_name, int recurse) 966static noinline int do_loopback(struct nameidata *nd, char *old_name,
967 int recurse)
965{ 968{
966 struct nameidata old_nd; 969 struct nameidata old_nd;
967 struct vfsmount *mnt = NULL; 970 struct vfsmount *mnt = NULL;
@@ -1010,8 +1013,9 @@ out:
1010 * change filesystem flags. dir should be a physical root of filesystem. 1013 * change filesystem flags. dir should be a physical root of filesystem.
1011 * If you've mounted a non-root directory somewhere and want to do remount 1014 * If you've mounted a non-root directory somewhere and want to do remount
1012 * on it - tough luck. 1015 * on it - tough luck.
1016 * noinline this do_mount helper to save do_mount stack space.
1013 */ 1017 */
1014static int do_remount(struct nameidata *nd, int flags, int mnt_flags, 1018static noinline int do_remount(struct nameidata *nd, int flags, int mnt_flags,
1015 void *data) 1019 void *data)
1016{ 1020{
1017 int err; 1021 int err;
@@ -1046,7 +1050,10 @@ static inline int tree_contains_unbindable(struct vfsmount *mnt)
1046 return 0; 1050 return 0;
1047} 1051}
1048 1052
1049static int do_move_mount(struct nameidata *nd, char *old_name) 1053/*
1054 * noinline this do_mount helper to save do_mount stack space.
1055 */
1056static noinline int do_move_mount(struct nameidata *nd, char *old_name)
1050{ 1057{
1051 struct nameidata old_nd, parent_nd; 1058 struct nameidata old_nd, parent_nd;
1052 struct vfsmount *p; 1059 struct vfsmount *p;
@@ -1121,8 +1128,9 @@ out:
1121/* 1128/*
1122 * create a new mount for userspace and request it to be added into the 1129 * create a new mount for userspace and request it to be added into the
1123 * namespace's tree 1130 * namespace's tree
1131 * noinline this do_mount helper to save do_mount stack space.
1124 */ 1132 */
1125static int do_new_mount(struct nameidata *nd, char *type, int flags, 1133static noinline int do_new_mount(struct nameidata *nd, char *type, int flags,
1126 int mnt_flags, char *name, void *data) 1134 int mnt_flags, char *name, void *data)
1127{ 1135{
1128 struct vfsmount *mnt; 1136 struct vfsmount *mnt;