linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Tejun Heo <tj@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Preeti U Murthy <preeti@linux.vnet.ibm.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Subject: Re: [Query]: delayed wq not killed completely with cancel_delayed_work_sync()
Date: Tue, 9 Jun 2015 16:56:27 +0530	[thread overview]
Message-ID: <20150609112627.GA27004@linux> (raw)
In-Reply-To: <20150609111811.GA17763@linux>

On 09-06-15, 16:48, Viresh Kumar wrote:
> On 09-06-15, 16:43, Viresh Kumar wrote:
> > HI Tejun,
> >
> > We had few races in cpufreq core for some time now and we
> > are looking to fix them.
> >
> > Briefly, we run a delayed_work on each cpu at a fixed interval
> > (sampling rate) and when that expires that take a look at system
> > load and adjust frequency accordingly. We also requeue the
> > delayed-works from these handlers.
> >
> > The problem we are facing is NULL pointer dereference from
> > work handler..
> >
> > Before we set the pointers to NULL and free resource (for which
> > we are seeing the crashes), we cancel the delayed works with
> > cancel_delayed_work_sync(&dwork);
> >
> > We expect the work to not fire at all once this returns, but it
> > looks like the work handler does get called..
> >
> > The mainline version of cpufreq_governor.c is a bit older than
> > what we have, but I just wanted the clarification on the routine
> > itself.
> >
> > Thanks for reading this :)

And another query:

Do we have support for this kind of scenarios in wq framework ?

- Enqueue a single delayed work for a group of CPUs (and should fire
  on any one of them). We are doing this per-cpu today in cpufreq.
- It has to be a deffered one, so that if none of the CPUs from that
  group are online, we don't fire it.
- As the per-cpu workqueue thing is unnecessary burden on CPUs.

Thanks.

-- 
viresh

  reply	other threads:[~2015-06-09 11:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAKohpon4Fj3YFgEmGtKH9ePscgiuvq0_PfMMsEboQsaGxaTPfw@mail.gmail.com>
2015-06-09 11:18 ` [Query]: delayed wq not killed completely with cancel_delayed_work_sync() Viresh Kumar
2015-06-09 11:26   ` Viresh Kumar [this message]
2015-06-10  5:03     ` Tejun Heo
2015-06-10  6:20       ` Viresh Kumar
2015-06-10  7:07         ` Tejun Heo
2015-06-10  7:19           ` Viresh Kumar

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=20150609112627.GA27004@linux \
    --to=viresh.kumar@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=preeti@linux.vnet.ibm.com \
    --cc=rjw@rjwysocki.net \
    --cc=tj@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;
as well as URLs for NNTP newsgroup(s).