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

Commit 2f7f916c authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "tasks, sched/core: Ensure tasks are available for a grace period after leaving the runqueue"

parents a4238be0 32f37540
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1344,7 +1344,10 @@ struct task_struct {

	struct tlbflush_unmap_batch	tlb_ubc;

	union {
		refcount_t		rcu_users;
		struct rcu_head		rcu;
	};

	/* Cache last used pipe for splice(): */
	struct pipe_inode_info		*splice_pipe;
+1 −0
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ static inline void put_task_struct(struct task_struct *t)
}

struct task_struct *task_rcu_dereference(struct task_struct **ptask);
void put_task_struct_rcu_user(struct task_struct *task);

#ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT
extern int arch_task_struct_size __read_mostly;
+6 −1
Original line number Diff line number Diff line
@@ -181,6 +181,11 @@ static void delayed_put_task_struct(struct rcu_head *rhp)
	put_task_struct(tsk);
}

void put_task_struct_rcu_user(struct task_struct *task)
{
	if (refcount_dec_and_test(&task->rcu_users))
		call_rcu(&task->rcu, delayed_put_task_struct);
}

void release_task(struct task_struct *p)
{
@@ -221,7 +226,7 @@ void release_task(struct task_struct *p)

	write_unlock_irq(&tasklist_lock);
	release_thread(p);
	call_rcu(&p->rcu, delayed_put_task_struct);
	put_task_struct_rcu_user(p);

	p = leader;
	if (unlikely(zap_leader))
+5 −3
Original line number Diff line number Diff line
@@ -897,10 +897,12 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node)
#endif

	/*
	 * One for us, one for whoever does the "release_task()" (usually
	 * parent)
	 * One for the user space visible state that goes away when reaped.
	 * One for the scheduler.
	 */
	atomic_set(&tsk->usage, 2);
	refcount_set(&tsk->rcu_users, 2);
	/* One for the rcu users */
	atomic_set(&tsk->usage, 1);
#ifdef CONFIG_BLK_DEV_IO_TRACE
	tsk->btrace_seq = 0;
#endif
+1 −1
Original line number Diff line number Diff line
@@ -3437,7 +3437,7 @@ static struct rq *finish_task_switch(struct task_struct *prev)
		/* Task is done with its stack. */
		put_task_stack(prev);

		put_task_struct(prev);
		put_task_struct_rcu_user(prev);
	}

	tick_nohz_task_switch();