Messages in this thread | | | Date | Tue, 22 Feb 2022 08:36:16 -1000 | From | Tejun Heo <> | Subject | Re: [PATCH v2] workqueue: Warn flush attempt using system-wide workqueues |
| |
On Thu, Feb 17, 2022 at 08:22:30PM +0900, Tetsuo Handa wrote: > @@ -335,6 +335,18 @@ enum { > */ > WQ_POWER_EFFICIENT = 1 << 7, > > + /* > + * Since flush operation synchronously waits for completion, flushing > + * system-wide workqueues (e.g. system_wq) or a work on a system-wide > + * workqueue might introduce possibility of deadlock due to unexpected > + * locking dependency. > + * > + * This flag emits warning if flush operation is attempted. Don't set > + * this flag on user-defined workqueues, for destroy_workqueue() will > + * involve flush operation. > + */ > + WQ_WARN_FLUSH_ATTEMPT = 1 << 8,
Maybe just __WQ_NO_FLUSH?
> __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */ > __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */ > __WQ_LEGACY = 1 << 18, /* internal: create*_workqueue() */ ... > +static void warn_flush_attempt(struct workqueue_struct *wq) > +{ > + static DEFINE_RATELIMIT_STATE(flush_warn_rs, 600 * HZ, 1); > + > + > + /* Use ratelimit for now in order not to flood warning messages. */ > + ratelimit_set_flags(&flush_warn_rs, RATELIMIT_MSG_ON_RELEASE); > + if (!__ratelimit(&flush_warn_rs)) > + return;
If you're worried about spamming console while conversion is in progress, we can just print the immediate (and maybe one more) caller with %pf and __builtin_return_address() so that it only prints out one line.
Thanks.
-- tejun
| |