Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42b2dd0a authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds
Browse files

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: default avatarAlexey Dobriyan <adobriyan@sw.ru>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent bcbba6c1
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1132,13 +1132,14 @@ struct task_struct {
	int cpuset_mems_generation;
	int cpuset_mems_generation;
	int cpuset_mem_spread_rotor;
	int cpuset_mem_spread_rotor;
#endif
#endif
#ifdef CONFIG_FUTEX
	struct robust_list_head __user *robust_list;
	struct robust_list_head __user *robust_list;
#ifdef CONFIG_COMPAT
#ifdef CONFIG_COMPAT
	struct compat_robust_list_head __user *compat_robust_list;
	struct compat_robust_list_head __user *compat_robust_list;
#endif
#endif
	struct list_head pi_state_list;
	struct list_head pi_state_list;
	struct futex_pi_state *pi_state_cache;
	struct futex_pi_state *pi_state_cache;

#endif
	atomic_t fs_excl;	/* holding fs exclusive resources */
	atomic_t fs_excl;	/* holding fs exclusive resources */
	struct rcu_head rcu;
	struct rcu_head rcu;


+5 −1
Original line number Original line Diff line number Diff line
@@ -947,11 +947,13 @@ fastcall NORET_TYPE void do_exit(long code)
		exit_itimers(tsk->signal);
		exit_itimers(tsk->signal);
	}
	}
	acct_collect(code, group_dead);
	acct_collect(code, group_dead);
#ifdef CONFIG_FUTEX
	if (unlikely(tsk->robust_list))
	if (unlikely(tsk->robust_list))
		exit_robust_list(tsk);
		exit_robust_list(tsk);
#if defined(CONFIG_FUTEX) && defined(CONFIG_COMPAT)
#ifdef CONFIG_COMPAT
	if (unlikely(tsk->compat_robust_list))
	if (unlikely(tsk->compat_robust_list))
		compat_exit_robust_list(tsk);
		compat_exit_robust_list(tsk);
#endif
#endif
#endif
	if (group_dead)
	if (group_dead)
		tty_audit_exit();
		tty_audit_exit();
@@ -987,6 +989,7 @@ fastcall NORET_TYPE void do_exit(long code)
	mpol_free(tsk->mempolicy);
	mpol_free(tsk->mempolicy);
	tsk->mempolicy = NULL;
	tsk->mempolicy = NULL;
#endif
#endif
#ifdef CONFIG_FUTEX
	/*
	/*
	 * This must happen late, after the PID is not
	 * This must happen late, after the PID is not
	 * hashed anymore:
	 * hashed anymore:
@@ -995,6 +998,7 @@ fastcall NORET_TYPE void do_exit(long code)
		exit_pi_state_list(tsk);
		exit_pi_state_list(tsk);
	if (unlikely(current->pi_state_cache))
	if (unlikely(current->pi_state_cache))
		kfree(current->pi_state_cache);
		kfree(current->pi_state_cache);
#endif
	/*
	/*
	 * Make sure we are holding no locks:
	 * Make sure we are holding no locks:
	 */
	 */
+2 −1
Original line number Original line Diff line number Diff line
@@ -1156,13 +1156,14 @@ static struct task_struct *copy_process(unsigned long clone_flags,
	 * Clear TID on mm_release()?
	 * Clear TID on mm_release()?
	 */
	 */
	p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL;
	p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL;
#ifdef CONFIG_FUTEX
	p->robust_list = NULL;
	p->robust_list = NULL;
#ifdef CONFIG_COMPAT
#ifdef CONFIG_COMPAT
	p->compat_robust_list = NULL;
	p->compat_robust_list = NULL;
#endif
#endif
	INIT_LIST_HEAD(&p->pi_state_list);
	INIT_LIST_HEAD(&p->pi_state_list);
	p->pi_state_cache = NULL;
	p->pi_state_cache = NULL;

#endif
	/*
	/*
	 * sigaltstack should be cleared when sharing the same VM
	 * sigaltstack should be cleared when sharing the same VM
	 */
	 */