All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juri Lelli <juri.lelli@redhat.com>
To: Waiman Long <longman@redhat.com>
Cc: Tejun Heo <tj@kernel.org>, Lai Jiangshan <jiangshanlai@gmail.com>,
	linux-kernel@vger.kernel.org, Cestmir Kalina <ckalina@redhat.com>,
	Alex Gladkov <agladkov@redhat.com>
Subject: Re: [RFC PATCH 0/3] workqueue: Enable unbound cpumask update on ordered workqueues
Date: Mon, 5 Feb 2024 07:30:17 +0100	[thread overview]
Message-ID: <ZcCAefuXoVAFgew4@localhost.localdomain> (raw)
In-Reply-To: <d7adf125-52d2-47b1-9abb-c2c085eb5382@redhat.com>

On 02/02/24 14:03, Waiman Long wrote:
> On 2/2/24 12:07, Tejun Heo wrote:
> > Hello,
> > 
> > On Fri, Feb 02, 2024 at 03:55:15PM +0100, Juri Lelli wrote:
> > > Indeed. I believe this is what my 3/4 [1] was trying to cure, though. I
> > > still think that with current code the new_attr->cpumask gets first
> > > correctly initialized considering unbound_cpumask
> > > 
> > > apply_wqattrs_prepare ->
> > >    copy_workqueue_attrs(new_attrs, attrs);
> > >    wqattrs_actualize_cpumask(new_attrs, unbound_cpumask);
> > > 
> > > but then overwritten further below using cpu_possible_mask
> > > 
> > > apply_wqattrs_prepare ->
> > >    copy_workqueue_attrs(new_attrs, attrs);
> > >    cpumask_and(new_attrs->cpumask, new_attrs->cpumask, cpu_possible_mask);
> > > 
> > > operation that I honestly seem to still fail to grasp why we need to do.
> > > :)
> > So, imagine the following scenario on a system with four CPUs:
> > 
> > 1. Initially both wq_unbound_cpumask and wq A's cpumask are 0xf.
> > 
> > 2. wq_unbound_cpumask is set to 0x3. A's effective is 0x3.
> > 
> > 3. A's cpumask is set to 0xe, A's effective is 0x3.
> > 
> > 4. wq_unbound_cpumask is restore to 0xf. A's effective should become 0xe.
> > 
> > The reason why we're saving what user requested rather than effective is to
> > be able to do #4 so that the effective is always what's currently allowed
> > from what the user specified for the workqueue.

Thanks for the explanation!

> > Now, if you want the current effective cpumask, that always coincides with
> > the workqueue's dfl_pwq's __pod_cpumask and if you look at the current
> > wq/for-6.9 branch, that's accessible through unbound_effective_cpumask()
> > helper.
> 
> Thank for the explanation, we will use the new unbound_effective_cpumask()
> helper.

Right, that should indeed work.

Best,
Juri


      reply	other threads:[~2024-02-05  6:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-30 18:33 [RFC PATCH 0/3] workqueue: Enable unbound cpumask update on ordered workqueues Waiman Long
2024-01-30 18:33 ` [RFC PATCH 1/3] workqueue: Skip __WQ_DESTROYING workqueues when updating global unbound cpumask Waiman Long
2024-01-30 18:33 ` [RFC PATCH 2/3] workqueue: Break out __queue_work_rcu_locked() from __queue_work() Waiman Long
2024-01-30 18:33 ` [RFC PATCH 3/3] workqueue: Enable unbound cpumask update on ordered workqueues Waiman Long
2024-01-31 17:00   ` Tejun Heo
2024-01-31 17:02     ` Waiman Long
2024-01-31 13:01 ` [RFC PATCH 0/3] " Juri Lelli
2024-01-31 15:31   ` Waiman Long
2024-02-01 10:18     ` Juri Lelli
2024-02-01 14:28       ` Waiman Long
2024-02-02 14:55         ` Juri Lelli
2024-02-02 17:07           ` Tejun Heo
2024-02-02 19:03             ` Waiman Long
2024-02-05  6:30               ` Juri Lelli [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=ZcCAefuXoVAFgew4@localhost.localdomain \
    --to=juri.lelli@redhat.com \
    --cc=agladkov@redhat.com \
    --cc=ckalina@redhat.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.