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

Commit 2607d7a6 authored by Tejun Heo's avatar Tejun Heo
Browse files

workqueue: keep track of the flushing task and pool manager



Add wq_barrier->task and worker_pool->manager to keep track of the
flushing task and pool manager respectively.  These are purely
informational and will be used to implement sysrq dump of workqueues.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent e2dca7ad
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -159,6 +159,7 @@ struct worker_pool {


	/* see manage_workers() for details on the two manager mutexes */
	/* see manage_workers() for details on the two manager mutexes */
	struct mutex		manager_arb;	/* manager arbitration */
	struct mutex		manager_arb;	/* manager arbitration */
	struct worker		*manager;	/* L: purely informational */
	struct mutex		attach_mutex;	/* attach/detach exclusion */
	struct mutex		attach_mutex;	/* attach/detach exclusion */
	struct list_head	workers;	/* A: attached workers */
	struct list_head	workers;	/* A: attached workers */
	struct completion	*detach_completion; /* all workers detached */
	struct completion	*detach_completion; /* all workers detached */
@@ -1918,9 +1919,11 @@ static bool manage_workers(struct worker *worker)
	 */
	 */
	if (!mutex_trylock(&pool->manager_arb))
	if (!mutex_trylock(&pool->manager_arb))
		return false;
		return false;
	pool->manager = worker;


	maybe_create_worker(pool);
	maybe_create_worker(pool);


	pool->manager = NULL;
	mutex_unlock(&pool->manager_arb);
	mutex_unlock(&pool->manager_arb);
	return true;
	return true;
}
}
@@ -2310,6 +2313,7 @@ static int rescuer_thread(void *__rescuer)
struct wq_barrier {
struct wq_barrier {
	struct work_struct	work;
	struct work_struct	work;
	struct completion	done;
	struct completion	done;
	struct task_struct	*task;	/* purely informational */
};
};


static void wq_barrier_func(struct work_struct *work)
static void wq_barrier_func(struct work_struct *work)
@@ -2358,6 +2362,7 @@ static void insert_wq_barrier(struct pool_workqueue *pwq,
	INIT_WORK_ONSTACK(&barr->work, wq_barrier_func);
	INIT_WORK_ONSTACK(&barr->work, wq_barrier_func);
	__set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&barr->work));
	__set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&barr->work));
	init_completion(&barr->done);
	init_completion(&barr->done);
	barr->task = current;


	/*
	/*
	 * If @target is currently being executed, schedule the
	 * If @target is currently being executed, schedule the