mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: huangzaiyang <huangzaiyang@oppo.com>
Cc: jiangshanlai@gmail.com, linux-kernel@vger.kernel.org,
	ZaiYang Huang <hzy0719@163.com>
Subject: Re: [PATCH] workqueue: Make a warning when a pending delay work being re-init
Date: Wed, 15 Nov 2023 16:58:34 -1000	[thread overview]
Message-ID: <ZVWFWh_HL_wzYyd1@mtj.duckdns.org> (raw)
In-Reply-To: <20231115113427.1420-1-huangzaiyang@oppo.com>

Hello,

On Wed, Nov 15, 2023 at 07:34:27PM +0800, huangzaiyang wrote:
> @@ -310,6 +326,7 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
> 
>  #define __INIT_DELAYED_WORK(_work, _func, _tflags)                     \
>         do {                                                            \
> +               WARN_ON(delayed_work_pending(_work));                   \
>                 INIT_WORK(&(_work)->work, (_func));                     \
>                 __init_timer(&(_work)->timer,                           \
>                              delayed_work_timer_fn,                     \

As pointed out by others, as we don't know what's in the memory, this
wouldn't really work. This kind of bugs should be caught by
DEBUG_OBJECTS_WORK / DEBUG_OBJECTS_TIMERS, I think. It's not perfect as
those aren't usually turned on but catching this sort of errors does need
tracking some information out of band.

Thanks.

-- 
tejun

  parent reply	other threads:[~2023-11-16  2:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 11:34 huangzaiyang
2023-11-15 13:54 ` Mukesh Ojha
2023-11-15 21:14 ` Thomas Weißschuh
2023-11-16  0:22   ` 回复: " 黄再漾(Joyyoung Huang)
2023-11-16  1:53     ` 黄再漾(Joyyoung Huang)
2023-11-16  4:13       ` Thomas Weißschuh
2023-11-16  2:58 ` Tejun Heo [this message]
2023-11-16  7:26   ` 黄再漾(Joyyoung Huang)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZVWFWh_HL_wzYyd1@mtj.duckdns.org \
    --to=tj@kernel.org \
    --cc=huangzaiyang@oppo.com \
    --cc=hzy0719@163.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®