[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140501144908.GB25369@localhost.localdomain>
Date: Thu, 1 May 2014 16:49:10 +0200
From: Frederic Weisbecker <fweisbec@...il.com>
To: Tejun Heo <tj@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Christoph Lameter <cl@...ux.com>,
Kevin Hilman <khilman@...aro.org>,
Lai Jiangshan <laijs@...fujitsu.com>,
Mike Galbraith <bitbucket@...ine.de>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Viresh Kumar <viresh.kumar@...aro.org>
Subject: Re: [PATCH 3/4] workqueue: Allow modifying low level unbound
workqueue cpumask
On Thu, Apr 24, 2014 at 11:30:48AM -0400, Tejun Heo wrote:
> On Thu, Apr 24, 2014 at 04:37:35PM +0200, Frederic Weisbecker wrote:
> > +static int apply_workqueue_attrs_locked(struct workqueue_struct *wq,
> > + const struct workqueue_attrs *attrs);
>
> Can't we reorder things so that we don't need the above prototype?
Yeah I'll give it a try.
>
> > +/* Must be called with wq_unbound_mutex held */
>
> Please use lockdep_assert_held() instead.
Ok.
>
> > +static int unbounds_cpumask_apply_all(cpumask_var_t cpumask)
> > +{
> > + struct workqueue_struct *wq;
> > +
> > + list_for_each_entry(wq, &workqueues, list) {
> > + struct workqueue_attrs *attrs;
> > +
> > + if (!(wq->flags & WQ_UNBOUND))
> > + continue;
> > + /* Ordered workqueues need specific treatment */
> > + if (wq->flags & __WQ_ORDERED)
> > + continue;
> > +
> > + attrs = wq_sysfs_prep_attrs(wq);
> > + if (!attrs)
> > + return -ENOMEM;
>
> So, we're failing in the middle without rolling back?
Yeah, early patch :)
>
> > +
> > + WARN_ON_ONCE(apply_workqueue_attrs_locked(wq, attrs));
>
> Are we triggering WARN on -ENOMEM too and then ignore the failure?
Yeah some more thought is needed on error handling.
>
> > + free_workqueue_attrs(attrs);
> > + }
> > +
> > + return 0;
> > +}
>
> Shouldn't we separate allocation stage from switching stage so that we
> can either succeed or fail? The above is very mushy about error
> handling.
They are already pretty seperate above. But yeah I need to rework the error
handling.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists