From: Frederic Weisbecker <fweisbec@gmail.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Christoph Lameter <cl@linux.com>,
Kevin Hilman <khilman@linaro.org>,
Mike Galbraith <bitbucket@online.de>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Tejun Heo <tj@kernel.org>, Viresh Kumar <viresh.kumar@linaro.org>
Subject: Re: [PATCH 6/6] workqueue: Record real per-workqueue cpumask
Date: Tue, 13 May 2014 16:55:22 +0200 [thread overview]
Message-ID: <20140513145519.GA13828@localhost.localdomain> (raw)
In-Reply-To: <CACvQF526QozPynmw46k36qZvPJFU1Tk0S5ii35zMH7dhCYNUzg@mail.gmail.com>
On Thu, May 08, 2014 at 09:20:45PM +0800, Lai Jiangshan wrote:
> On Thu, May 8, 2014 at 12:37 AM, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> > The real cpumask set by the user on WQ_SYSFS workqueues fails to be
> > recorded as is: What is actually recorded as per workqueue attribute
> > is the per workqueue cpumask intersected with the global unbounds cpumask.
> >
> > Eventually when the user overwrites a WQ_SYSFS cpumask and later read
> > this attibute, the value returned is not the last one written.
> >
> > The other bad side effect is that widening the global unbounds cpumask
> > doesn't actually widen the unbound workqueues affinity because their
> > own cpumask has been schrinked.
> >
> > In order to fix this, lets record the real per workqueue cpumask on the
> > workqueue struct. We restore this value when attributes are re-evaluated
> > later.
> >
> > FIXME: Maybe I should rather invert that. Have the user set workqueue
> > cpumask on attributes and the effective one on the workqueue struct instead.
> > We'll just need some tweaking in order to make the attributes of lower layers
> > (pools, worker pools, worker, ...) to inherit the effective cpumask and not
> > the user one.
> >
> > Cc: Christoph Lameter <cl@linux.com>
> > Cc: Kevin Hilman <khilman@linaro.org>
> > Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
> > Cc: Mike Galbraith <bitbucket@online.de>
> > Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > Cc: Tejun Heo <tj@kernel.org>
> > Cc: Viresh Kumar <viresh.kumar@linaro.org>
> > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> > ---
> > kernel/workqueue.c | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> > index 5978cee..504cf0a 100644
> > --- a/kernel/workqueue.c
> > +++ b/kernel/workqueue.c
> > @@ -248,6 +248,7 @@ struct workqueue_struct {
> > int saved_max_active; /* WQ: saved pwq max_active */
> >
> > struct workqueue_attrs *unbound_attrs; /* WQ: only for unbound wqs */
> > + cpumask_var_t saved_cpumask; /* WQ: only for unbound wqs */
>
>
> Forgot to use it? or use it in next patches?
Hmm, no it's used below.
>
> > struct pool_workqueue *dfl_pwq; /* WQ: only for unbound wqs */
> >
> > #ifdef CONFIG_SYSFS
> > @@ -3694,6 +3695,7 @@ static int apply_workqueue_attrs_locked(struct workqueue_struct *wq,
> > mutex_lock(&wq->mutex);
> >
> > copy_workqueue_attrs(wq->unbound_attrs, new_attrs);
> > + cpumask_copy(wq->saved_cpumask, attrs->cpumask);
>
> I think you can use ->unbound_attrs directly:
> copy_workqueue_attrs(wq->unbound_attrs, attrs);
>
> and update wq_update_unbound_numa():
> copy_workqueue_attrs(tmp_attrs, wq->unbound_attrs);
> cpumask_and(&tmp_attrs->cpumask, wq_unbound_cpumask)
>
> use tmp_attr instead of wq->unbound_attrs in the left code of
> wq_update_unbound_numa()
But wq_update_unbound_numa() is only called on cpu hotplug operations
right? So this may have no effect after setting a cpumask in sysfs.
How about keeping the sysfs cpu in wq's unbound_attrs but pass the effective
one to pwq creation in apply_workqueue_attrs_locked.
And also do what you suggest in wq_update_unbound_numa for hotplug
operations.
prev parent reply other threads:[~2014-05-13 14:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-07 16:36 [RFC PATCH 0/6] workqueue: Introduce low-level unbound wq sysfs cpumask v2 Frederic Weisbecker
2014-05-07 16:36 ` [PATCH 1/6] workqueue: Allow changing attributions of ordered workqueues Frederic Weisbecker
2014-05-07 16:36 ` [PATCH 2/6] workqueue: Reorder sysfs code Frederic Weisbecker
2014-05-07 16:36 ` [PATCH 3/6] workqueue: Create low-level unbound workqueues cpumask Frederic Weisbecker
2014-05-07 16:36 ` [PATCH 4/6] workqueue: Split apply attrs code from its locking Frederic Weisbecker
2014-05-07 16:37 ` [PATCH 5/6] workqueue: Allow modifying low level unbound workqueue cpumask Frederic Weisbecker
2014-05-08 13:22 ` Lai Jiangshan
2014-05-13 14:58 ` Frederic Weisbecker
2014-05-07 16:37 ` [PATCH 6/6] workqueue: Record real per-workqueue cpumask Frederic Weisbecker
2014-05-08 13:20 ` Lai Jiangshan
2014-05-13 14:55 ` Frederic Weisbecker [this message]
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=20140513145519.GA13828@localhost.localdomain \
--to=fweisbec@gmail.com \
--cc=bitbucket@online.de \
--cc=cl@linux.com \
--cc=khilman@linaro.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=tj@kernel.org \
--cc=viresh.kumar@linaro.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