mark various functions as noinline_for_stack
Subsystems (3)
cover mark various functions as noinline_for_stack
After I noinlined a few sys_mount helpers for stack reasons, there was discussion of a special self-documenting noinline. I said I'd send a patch to do that, but shirked my duty. I see that Andrew has put "noinline_for_stack" into place already.... as penance, I've gone through a few subsystems using "noinline" and where specific stack-related comments existed, I replaced noinline with noinline_for_stack and removed the comments.
Thanks,
-Eric
PATCH 1/4 mark sys_mount helper functions as noinline_for_stack
Use the self-documenting noinline_for_stack attribute in sys_mount helper functions.
---
fs/namespace.c +8 -14
@@ -946,9 +946,8 @@ out_unlock:/* * recursively change the type of the mountpoint. -* noinline this do_mount helper to save do_mount stack space. */ -static noinline int do_change_type(struct nameidata *nd, int flag) +static noinline_for_stack int do_change_type(struct nameidata *nd, int flag) {struct vfsmount *m, *mnt = nd->path.mnt;int recurse = flag &MS_REC ;
@@ -971,9 +970,8 @@ static noinline int do_change_type(struc/* * do loopback mount. -* noinline this do_mount helper to save do_mount stack space. */ -static noinline int do_loopback(struct nameidata *nd, char *old_name, +static noinline_for_stack int do_loopback(struct nameidata *nd, char *old_name,int recurse) {struct nameidata old_nd;
@@ -1023,10 +1021,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 noinline int do_remount(struct nameidata *nd, int flags, int mnt_flags, -void *data) +static noinline_for_stack int do_remount(struct nameidata *nd, int flags, +int mnt_flags,void *data) {int err;struct super_block *sb = nd->path.mnt->mnt_sb;
@@ -1060,10 +1057,8 @@ static inline int tree_contains_unbindabreturn 0 ; } -/* -* noinline this do_mount helper to save do_mount stack space. -*/ -static noinline int do_move_mount(struct nameidata *nd, char *old_name) +static noinline_for_stack int do_move_mount(struct nameidata *nd, +char *old_name) {struct nameidata old_nd;struct path parent_path;
@@ -1141,10 +1136,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 noinline int do_new_mount(struct nameidata *nd, char *type, int flags, -int mnt_flags,char *name,void *data) +static noinline_for_stack int do_new_mount(struct nameidata *nd, char *type, +int flags,int mnt_flags,char *name,void *data) {struct vfsmount *mnt;
PATCH 2/4 mark lockdep functions as noinline_for_stack
In reply to Eric SandeenUse the self-documenting noinline_for_stack attribute in lockdep functions.
---
kernel/lockdep.c +7 -7
@@ -878,7 +878,7 @@ static struct held_lock *check_source, ** Print a dependency chain entry (this is only done when a deadlock * has been detected): */ -static noinline int +static noinline_for_stack intprint_circular_bug_entry (struct lock_list *target,unsigned int depth) {if (debug_locks_silent)
@@ -895,7 +895,7 @@ print_circular_bug_entry(struct lock_lis* When a circular dependency is detected, print the * header first: */ -static noinline int +static noinline_for_stack intprint_circular_bug_header (struct lock_list *entry,unsigned int depth) {struct task_struct *curr = current;
@@ -920,7 +920,7 @@ print_circular_bug_header(struct lock_lireturn 0 ; } -static noinline int print_circular_bug_tail(void) +static noinline_for_stack int print_circular_bug_tail(void) {struct task_struct *curr = current;struct lock_list this;
@@ -945,7 +945,7 @@ static noinline int print_circular_bug_t#define RECURSION_LIMIT 40 -static int noinline print_infinite_recursion_bug(void) +static int noinline_for_stack print_infinite_recursion_bug(void) {if (!debug_locks_off_graph_unlock ())return 0 ;
@@ -959,7 +959,7 @@ static int noinline print_infinite_recur* Prove that the dependency graph starting at <entry> can not * lead to <target>. Print an error and return 0 if it does. */ -static noinline int +static noinline_for_stack intcheck_noncircular (struct lock_class *source,unsigned int depth) {struct lock_list *entry;
@@ -1001,7 +1001,7 @@ static struct lock_class *forwards_match* Return 1 otherwise and keep <forwards_match> unchanged. * Return 0 on error. */ -static noinline int +static noinline_for_stack intfind_usage_forwards (struct lock_class *source,unsigned int depth) {struct lock_list *entry;
@@ -1040,7 +1040,7 @@ find_usage_forwards(struct lock_class *s* Return 1 otherwise and keep <backwards_match> unchanged. * Return 0 on error. */ -static noinline int +static noinline_for_stack intfind_usage_backwards (struct lock_class *source,unsigned int depth) {struct lock_list *entry;
PATCH 3/4 mark loop functions as noinline_for_stack
In reply to Eric SandeenUse the self-documenting noinline_for_stack attribute in loop functions.
---
drivers/block/loop.c +2 -4
@@ -1182,9 +1182,8 @@ struct compat_loop_info {/* * Transfer 32-bit compatibility structure in userspace to 64-bit loop info -* - noinlined to reduce stack space usage in main part of driver */ -static noinline int +static noinline_for_stack intloop_info64_from_compat (const struct compat_loop_info __user *arg,struct loop_info64 *info64) {
@@ -1215,9 +1214,8 @@ loop_info64_from_compat(const struct com/* * Transfer 64-bit loop info to 32-bit compatibility structure in userspace -* - noinlined to reduce stack space usage in main part of driver */ -static noinline int +static noinline_for_stack intloop_info64_to_compat (const struct loop_info64 *info64,struct compat_loop_info __user *arg) {
PATCH 4/4 mark inflate functions as noinline_for_stack
In reply to Eric SandeenUse the self-documenting noinline_for_stack attribute in inflate functions.
---
lib/inflate.c +2 -8
@@ -716,10 +716,7 @@ DEBG("<stor"); } -/* -* We use `noinline' here to prevent gcc-3.5 from using too much stack space -*/ -STATIC int noinline INIT inflate_fixed(void) +STATIC int noinline_for_stack INIT inflate_fixed(void)/* decompress an inflated type 1 (fixed Huffman codes) block. We should either replace this with a custom decoder, or at least precompute the Huffman tables. */
@@ -780,10 +777,7 @@ DEBG("<fix"); } -/* -* We use `noinline' here to prevent gcc-3.5 from using too much stack space -*/ -STATIC int noinline INIT inflate_dynamic(void) +STATIC int noinline_for_stack INIT inflate_dynamic(void)/* decompress an inflated type 2 (dynamic Huffman codes) block. */ {int i;/* temporary variables */