* [PATCH] workqueue: respect isolated cpus when queueing an unbound work
@ 2017-10-19 21:44 Tal Shorer
2017-10-21 15:49 ` Tejun Heo
0 siblings, 1 reply; 6+ messages in thread
From: Tal Shorer @ 2017-10-19 21:44 UTC (permalink / raw)
To: tj, jiangshanlai, linux-kernel; +Cc: Tal Shorer
Initialize wq_unbound_cpumask to exclude cpus that were isolated by
the cmdline's isolcpus parameter.
Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
---
kernel/workqueue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index ca937b0..25b351d 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5546,7 +5546,7 @@ int __init workqueue_init_early(void)
WARN_ON(__alignof__(struct pool_workqueue) < __alignof__(long long));
BUG_ON(!alloc_cpumask_var(&wq_unbound_cpumask, GFP_KERNEL));
- cpumask_copy(wq_unbound_cpumask, cpu_possible_mask);
+ cpumask_andnot(wq_unbound_cpumask, cpu_possible_mask, cpu_isolated_map);
pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC);
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] workqueue: respect isolated cpus when queueing an unbound work
2017-10-19 21:44 [PATCH] workqueue: respect isolated cpus when queueing an unbound work Tal Shorer
@ 2017-10-21 15:49 ` Tejun Heo
[not found] ` <CAFDyS3Mgt=Vt-sJXVL_pY_DwrC2dDTDQ0jMNyAbCwvLptu88Sw@mail.gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Tejun Heo @ 2017-10-21 15:49 UTC (permalink / raw)
To: Tal Shorer; +Cc: jiangshanlai, linux-kernel
On Fri, Oct 20, 2017 at 12:44:06AM +0300, Tal Shorer wrote:
> Initialize wq_unbound_cpumask to exclude cpus that were isolated by
> the cmdline's isolcpus parameter.
>
> Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
> ---
> kernel/workqueue.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index ca937b0..25b351d 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -5546,7 +5546,7 @@ int __init workqueue_init_early(void)
> WARN_ON(__alignof__(struct pool_workqueue) < __alignof__(long long));
>
> BUG_ON(!alloc_cpumask_var(&wq_unbound_cpumask, GFP_KERNEL));
> - cpumask_copy(wq_unbound_cpumask, cpu_possible_mask);
> + cpumask_andnot(wq_unbound_cpumask, cpu_possible_mask, cpu_isolated_map);
Don't we also wanna apply the same masking when wq_unbound_cpumask is
being updated after boot?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] workqueue: respect isolated cpus when queueing an unbound work
[not found] ` <20171021160446.GO1302522@devbig577.frc2.facebook.com>
@ 2017-10-21 16:13 ` Tal Shorer
2017-10-21 16:15 ` Tejun Heo
0 siblings, 1 reply; 6+ messages in thread
From: Tal Shorer @ 2017-10-21 16:13 UTC (permalink / raw)
To: Tejun Heo; +Cc: jiangshanlai, <linux-kernel@vger.kernel.org>
On Sat, Oct 21, 2017 at 7:04 PM, Tejun Heo <tj@kernel.org> wrote:
> On Sat, Oct 21, 2017 at 07:02:21PM +0300, Tal Shorer wrote:
>> On Sat, Oct 21, 2017 at 6:49 PM, Tejun Heo <tj@kernel.org> wrote:
>> > On Fri, Oct 20, 2017 at 12:44:06AM +0300, Tal Shorer wrote:
>> >> Initialize wq_unbound_cpumask to exclude cpus that were isolated by
>> >> the cmdline's isolcpus parameter.
>> >>
>> >> Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
>> >> ---
>> >> kernel/workqueue.c | 2 +-
>> >> 1 file changed, 1 insertion(+), 1 deletion(-)
>> >>
>> >> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
>> >> index ca937b0..25b351d 100644
>> >> --- a/kernel/workqueue.c
>> >> +++ b/kernel/workqueue.c
>> >> @@ -5546,7 +5546,7 @@ int __init workqueue_init_early(void)
>> >> WARN_ON(__alignof__(struct pool_workqueue) < __alignof__(long long));
>> >>
>> >> BUG_ON(!alloc_cpumask_var(&wq_unbound_cpumask, GFP_KERNEL));
>> >> - cpumask_copy(wq_unbound_cpumask, cpu_possible_mask);
>> >> + cpumask_andnot(wq_unbound_cpumask, cpu_possible_mask, cpu_isolated_map);
>> >
>> > Don't we also wanna apply the same masking when wq_unbound_cpumask is
>> > being updated after boot?
>> >
>> I think that if the user actively enables unbound works on isolated
>> cpus, the kernel should allow that.
>
> (Please restore cc list when you reply.)
>
> Do we have a consistent behavior around this? Are there different
> examples where isolcpus interact with other dynamically configurable
> parameters?
>
sched_setaffinity comes to mind, which obviously bypasses isolcpus.
Running git grep, other uses of cpu_isolated_map are just its
initialization and its use and the initialization of
non_isolated_cpus.
> Thanks.
>
> --
> tejun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] workqueue: respect isolated cpus when queueing an unbound work
2017-10-21 16:13 ` Tal Shorer
@ 2017-10-21 16:15 ` Tejun Heo
2017-10-21 16:29 ` [PATCH v2] " Tal Shorer
0 siblings, 1 reply; 6+ messages in thread
From: Tejun Heo @ 2017-10-21 16:15 UTC (permalink / raw)
To: Tal Shorer; +Cc: jiangshanlai, <linux-kernel@vger.kernel.org>
Hello,
On Sat, Oct 21, 2017 at 07:13:33PM +0300, Tal Shorer wrote:
> > Do we have a consistent behavior around this? Are there different
> > examples where isolcpus interact with other dynamically configurable
> > parameters?
> >
> sched_setaffinity comes to mind, which obviously bypasses isolcpus.
> Running git grep, other uses of cpu_isolated_map are just its
> initialization and its use and the initialization of
> non_isolated_cpus.
Can you add a comment explaining that it's intentional that we only
follow isolcpus during boot and allow later overrides?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] workqueue: respect isolated cpus when queueing an unbound work
2017-10-21 16:15 ` Tejun Heo
@ 2017-10-21 16:29 ` Tal Shorer
2017-10-21 16:33 ` Tejun Heo
0 siblings, 1 reply; 6+ messages in thread
From: Tal Shorer @ 2017-10-21 16:29 UTC (permalink / raw)
To: tj, jiangshanlai, linux-kernel; +Cc: Tal Shorer
Initialize wq_unbound_cpumask to exclude cpus that were isolated by
the cmdline's isolcpus parameter.
Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
---
kernel/workqueue.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index ca937b0..0add5d4 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4947,6 +4947,10 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask)
if (!zalloc_cpumask_var(&saved_cpumask, GFP_KERNEL))
return -ENOMEM;
+ /*
+ * Not excluding isolated cpus on purpose.
+ * If the user wishes to include them, we allow that.
+ */
cpumask_and(cpumask, cpumask, cpu_possible_mask);
if (!cpumask_empty(cpumask)) {
apply_wqattrs_lock();
@@ -5546,7 +5550,7 @@ int __init workqueue_init_early(void)
WARN_ON(__alignof__(struct pool_workqueue) < __alignof__(long long));
BUG_ON(!alloc_cpumask_var(&wq_unbound_cpumask, GFP_KERNEL));
- cpumask_copy(wq_unbound_cpumask, cpu_possible_mask);
+ cpumask_andnot(wq_unbound_cpumask, cpu_possible_mask, cpu_isolated_map);
pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC);
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] workqueue: respect isolated cpus when queueing an unbound work
2017-10-21 16:29 ` [PATCH v2] " Tal Shorer
@ 2017-10-21 16:33 ` Tejun Heo
0 siblings, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2017-10-21 16:33 UTC (permalink / raw)
To: Tal Shorer; +Cc: jiangshanlai, linux-kernel
On Sat, Oct 21, 2017 at 07:29:24PM +0300, Tal Shorer wrote:
> Initialize wq_unbound_cpumask to exclude cpus that were isolated by
> the cmdline's isolcpus parameter.
>
> Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
Applied to wq/for-4.15.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-21 16:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-19 21:44 [PATCH] workqueue: respect isolated cpus when queueing an unbound work Tal Shorer
2017-10-21 15:49 ` Tejun Heo
[not found] ` <CAFDyS3Mgt=Vt-sJXVL_pY_DwrC2dDTDQ0jMNyAbCwvLptu88Sw@mail.gmail.com>
[not found] ` <20171021160446.GO1302522@devbig577.frc2.facebook.com>
2017-10-21 16:13 ` Tal Shorer
2017-10-21 16:15 ` Tejun Heo
2017-10-21 16:29 ` [PATCH v2] " Tal Shorer
2017-10-21 16:33 ` Tejun Heo
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).