* [PATCH] workqueue: Introduce show_freeze_workqueues_busy [not found] <CGME20230315130515epcas1p40823f20da586c1b5813b41e66e754309@epcas1p4.samsung.com> @ 2023-03-15 12:45 ` Jungseung Lee 2023-03-17 22:16 ` Tejun Heo 0 siblings, 1 reply; 3+ messages in thread From: Jungseung Lee @ 2023-03-15 12:45 UTC (permalink / raw) To: Tejun Heo, Lai Jiangshan, Rafael J. Wysocki, Pavel Machek, Len Brown, linux-kernel, linux-pm, bw365.lee, yw85.kim, huijin.park Cc: Jungseung Lee Currently show_all_workqueue() is called if freeze fails at the time of freeze the workqueues, which shows the status of all workqueues and of all worker pools. In this cases we may only need to dump state of only workqueues that are freezable and busy. This patch defines show_freeze_workqueues_busy, which uses show_one_workqueue, a granular function that shows the state of individual workqueues, so that dump only the state of freezable workqueues at that time. Signed-off-by: Jungseung Lee <js07.lee@samsung.com> --- include/linux/workqueue.h | 1 + kernel/power/process.c | 2 +- kernel/workqueue.c | 25 ++++++++++++++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 0a10f8e..3d68631 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -472,6 +472,7 @@ extern unsigned int work_busy(struct work_struct *work); extern __printf(1, 2) void set_worker_desc(const char *fmt, ...); extern void print_worker_info(const char *log_lvl, struct task_struct *task); extern void show_all_workqueues(void); +extern void show_freeze_workqueues_busy(void); extern void show_one_workqueue(struct workqueue_struct *wq); extern void wq_worker_comm(char *buf, size_t size, struct task_struct *task); diff --git a/kernel/power/process.c b/kernel/power/process.c index 6c1c7e5..590550f 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c @@ -93,7 +93,7 @@ static int try_to_freeze_tasks(bool user_only) todo - wq_busy, wq_busy); if (wq_busy) - show_all_workqueues(); + show_freeze_workqueues_busy(); if (!wakeup || pm_debug_messages_on) { read_lock(&tasklist_lock); diff --git a/kernel/workqueue.c b/kernel/workqueue.c index de42827..087eedb 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5043,7 +5043,7 @@ static void show_one_worker_pool(struct worker_pool *pool) /** * show_all_workqueues - dump workqueue state * - * Called from a sysrq handler or try_to_freeze_tasks() and prints out + * Called from a sysrq handler and prints out * all busy workqueues and pools. */ void show_all_workqueues(void) @@ -5065,6 +5065,29 @@ void show_all_workqueues(void) rcu_read_unlock(); } +/** + * show_freeze_workqueues_busy - dump freezable workqueue state + * + * Called from try_to_freeze_tasks() and prints out + * all freezable workqueues still busy. + */ +void show_freeze_workqueues_busy(void) +{ + struct workqueue_struct *wq; + + rcu_read_lock(); + + pr_info("Showing freezable workqueues still busy:\n"); + + list_for_each_entry_rcu(wq, &workqueues, list) { + if (!(wq->flags & WQ_FREEZABLE)) + continue; + show_one_workqueue(wq); + } + + rcu_read_unlock(); +} + /* used to show worker information through /proc/PID/{comm,stat,status} */ void wq_worker_comm(char *buf, size_t size, struct task_struct *task) { -- 2.7.4 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] workqueue: Introduce show_freeze_workqueues_busy 2023-03-15 12:45 ` [PATCH] workqueue: Introduce show_freeze_workqueues_busy Jungseung Lee @ 2023-03-17 22:16 ` Tejun Heo 2023-03-20 2:55 ` Jungseung Lee 0 siblings, 1 reply; 3+ messages in thread From: Tejun Heo @ 2023-03-17 22:16 UTC (permalink / raw) To: Jungseung Lee Cc: Lai Jiangshan, Rafael J. Wysocki, Pavel Machek, Len Brown, linux-kernel, linux-pm, bw365.lee, yw85.kim, huijin.park Hello, A few nits. On Wed, Mar 15, 2023 at 09:45:57PM +0900, Jungseung Lee wrote: > diff --git a/kernel/power/process.c b/kernel/power/process.c > index 6c1c7e5..590550f 100644 > --- a/kernel/power/process.c > +++ b/kernel/power/process.c > @@ -93,7 +93,7 @@ static int try_to_freeze_tasks(bool user_only) > todo - wq_busy, wq_busy); > > if (wq_busy) > - show_all_workqueues(); > + show_freeze_workqueues_busy(); Maybe name this show_freezable_workqueues()? > @@ -5043,7 +5043,7 @@ static void show_one_worker_pool(struct worker_pool *pool) > /** > * show_all_workqueues - dump workqueue state > * > - * Called from a sysrq handler or try_to_freeze_tasks() and prints out > + * Called from a sysrq handler and prints out > * all busy workqueues and pools. Can you reflow the comment to 80-col? > +/** > + * show_freeze_workqueues_busy - dump freezable workqueue state > + * > + * Called from try_to_freeze_tasks() and prints out > + * all freezable workqueues still busy. Ditto. Thanks. -- tejun ^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] workqueue: Introduce show_freeze_workqueues_busy 2023-03-17 22:16 ` Tejun Heo @ 2023-03-20 2:55 ` Jungseung Lee 0 siblings, 0 replies; 3+ messages in thread From: Jungseung Lee @ 2023-03-20 2:55 UTC (permalink / raw) To: 'Tejun Heo' Cc: 'Lai Jiangshan', 'Rafael J. Wysocki', 'Pavel Machek', 'Len Brown', linux-kernel, linux-pm, bw365.lee, yw85.kim, huijin.park Hi, Tejun >-----Original Message----- >From: Tejun Heo <htejun@gmail.com> On Behalf Of Tejun Heo >Sent: Saturday, March 18, 2023 7:16 AM >To: Jungseung Lee <js07.lee@samsung.com> >Cc: Lai Jiangshan <jiangshanlai@gmail.com>; Rafael J. Wysocki ><rafael@kernel.org>; Pavel Machek <pavel@ucw.cz>; Len Brown ><len.brown@intel.com>; linux-kernel@vger.kernel.org; linux- >pm@vger.kernel.org; bw365.lee@samsung.com; yw85.kim@samsung.com; >huijin.park@samsung.com >Subject: Re: [PATCH] workqueue: Introduce show_freeze_workqueues_busy > >Hello, > >A few nits. > >On Wed, Mar 15, 2023 at 09:45:57PM +0900, Jungseung Lee wrote: >> diff --git a/kernel/power/process.c b/kernel/power/process.c index >> 6c1c7e5..590550f 100644 >> --- a/kernel/power/process.c >> +++ b/kernel/power/process.c >> @@ -93,7 +93,7 @@ static int try_to_freeze_tasks(bool user_only) >> todo - wq_busy, wq_busy); >> >> if (wq_busy) >> - show_all_workqueues(); >> + show_freeze_workqueues_busy(); > >Maybe name this show_freezable_workqueues()? > >> @@ -5043,7 +5043,7 @@ static void show_one_worker_pool(struct >> worker_pool *pool) >> /** >> * show_all_workqueues - dump workqueue state >> * >> - * Called from a sysrq handler or try_to_freeze_tasks() and prints >> out >> + * Called from a sysrq handler and prints out >> * all busy workqueues and pools. > >Can you reflow the comment to 80-col? > >> +/** >> + * show_freeze_workqueues_busy - dump freezable workqueue state >> + * >> + * Called from try_to_freeze_tasks() and prints out >> + * all freezable workqueues still busy. > >Ditto. > Thank you for the review and I will send a new patch including what you mentioned soon Thanks, >Thanks. > >-- >tejun ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-20 2:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20230315130515epcas1p40823f20da586c1b5813b41e66e754309@epcas1p4.samsung.com>
2023-03-15 12:45 ` [PATCH] workqueue: Introduce show_freeze_workqueues_busy Jungseung Lee
2023-03-17 22:16 ` Tejun Heo
2023-03-20 2:55 ` Jungseung Lee
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®