aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@sw.ru>2007-10-17 02:27:30 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:42:55 -0400
commit42b2dd0a02c512cf59c96f5c227bf54bfe5bbf08 (patch)
treef9e4a572804897772d97e2db1ab0d2adcd28840c
parentbcbba6c10ef6b14b0542d7ed7380e95168175818 (diff)
Shrink task_struct if CONFIG_FUTEX=n
robust_list, compat_robust_list, pi_state_list, pi_state_cache are really used if futexes are on. Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/sched.h3
-rw-r--r--kernel/exit.c6
-rw-r--r--kernel/fork.c3
3 files changed, 9 insertions, 3 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 87f2eb27ee10..57166582a3f5 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1132,13 +1132,14 @@ struct task_struct {
1132 int cpuset_mems_generation; 1132 int cpuset_mems_generation;
1133 int cpuset_mem_spread_rotor; 1133 int cpuset_mem_spread_rotor;
1134#endif 1134#endif
1135#ifdef CONFIG_FUTEX
1135 struct robust_list_head __user *robust_list; 1136 struct robust_list_head __user *robust_list;
1136#ifdef CONFIG_COMPAT 1137#ifdef CONFIG_COMPAT
1137 struct compat_robust_list_head __user *compat_robust_list; 1138 struct compat_robust_list_head __user *compat_robust_list;
1138#endif 1139#endif
1139 struct list_head pi_state_list; 1140 struct list_head pi_state_list;
1140 struct futex_pi_state *pi_state_cache; 1141 struct futex_pi_state *pi_state_cache;
1141 1142#endif
1142 atomic_t fs_excl; /* holding fs exclusive resources */ 1143 atomic_t fs_excl; /* holding fs exclusive resources */
1143 struct rcu_head rcu; 1144 struct rcu_head rcu;
1144 1145
diff --git a/kernel/exit.c b/kernel/exit.c
index 4c108df88a37..2c704c86edb3 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -947,12 +947,14 @@ fastcall NORET_TYPE void do_exit(long code)
947 exit_itimers(tsk->signal); 947 exit_itimers(tsk->signal);
948 } 948 }
949 acct_collect(code, group_dead); 949 acct_collect(code, group_dead);
950#ifdef CONFIG_FUTEX
950 if (unlikely(tsk->robust_list)) 951 if (unlikely(tsk->robust_list))
951 exit_robust_list(tsk); 952 exit_robust_list(tsk);
952#if defined(CONFIG_FUTEX) && defined(CONFIG_COMPAT) 953#ifdef CONFIG_COMPAT
953 if (unlikely(tsk->compat_robust_list)) 954 if (unlikely(tsk->compat_robust_list))
954 compat_exit_robust_list(tsk); 955 compat_exit_robust_list(tsk);
955#endif 956#endif
957#endif
956 if (group_dead) 958 if (group_dead)
957 tty_audit_exit(); 959 tty_audit_exit();
958 if (unlikely(tsk->audit_context)) 960 if (unlikely(tsk->audit_context))
@@ -987,6 +989,7 @@ fastcall NORET_TYPE void do_exit(long code)
987 mpol_free(tsk->mempolicy); 989 mpol_free(tsk->mempolicy);
988 tsk->mempolicy = NULL; 990 tsk->mempolicy = NULL;
989#endif 991#endif
992#ifdef CONFIG_FUTEX
990 /* 993 /*
991 * This must happen late, after the PID is not 994 * This must happen late, after the PID is not
992 * hashed anymore: 995 * hashed anymore:
@@ -995,6 +998,7 @@ fastcall NORET_TYPE void do_exit(long code)
995 exit_pi_state_list(tsk); 998 exit_pi_state_list(tsk);
996 if (unlikely(current->pi_state_cache)) 999 if (unlikely(current->pi_state_cache))
997 kfree(current->pi_state_cache); 1000 kfree(current->pi_state_cache);
1001#endif
998 /* 1002 /*
999 * Make sure we are holding no locks: 1003 * Make sure we are holding no locks:
1000 */ 1004 */
diff --git a/kernel/fork.c b/kernel/fork.c
index 8a97e92c604f..3e764f6f2be1 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1156,13 +1156,14 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1156 * Clear TID on mm_release()? 1156 * Clear TID on mm_release()?
1157 */ 1157 */
1158 p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL; 1158 p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL;
1159#ifdef CONFIG_FUTEX
1159 p->robust_list = NULL; 1160 p->robust_list = NULL;
1160#ifdef CONFIG_COMPAT 1161#ifdef CONFIG_COMPAT
1161 p->compat_robust_list = NULL; 1162 p->compat_robust_list = NULL;
1162#endif 1163#endif
1163 INIT_LIST_HEAD(&p->pi_state_list); 1164 INIT_LIST_HEAD(&p->pi_state_list);
1164 p->pi_state_cache = NULL; 1165 p->pi_state_cache = NULL;
1165 1166#endif
1166 /* 1167 /*
1167 * sigaltstack should be cleared when sharing the same VM 1168 * sigaltstack should be cleared when sharing the same VM
1168 */ 1169 */