lkml.org 
[lkml]   [2018]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 1/3] sched/core: Warn if cpumask has a mix of isolcpus and housekeeping CPUs
Date
Currently when setting sched affinity, there are no checks to see if the
requested cpumask has CPUs from both isolcpus and housekeeping CPUs.
Mixing of isolcpus and housekeeping CPUs may lead to inconsistent
behaviours like tasks running on isolcpus with no load balancing.

Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
---
Changelog v2->v3:
Only a warning in sched_setaffinity. The actual detection is moved to
set_cpus_allowed_common.

kernel/sched/core.c | 11 +++++++++++

1 file changed, 11 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ad97f3b..3064e0f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4734,6 +4734,7 @@ static int sched_read_attr(struct sched_attr __user *uattr,
long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
{
cpumask_var_t cpus_allowed, new_mask;
+ const struct cpumask *hk_mask;
struct task_struct *p;
int retval;

@@ -4778,6 +4779,16 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)

cpuset_cpus_allowed(p, cpus_allowed);
cpumask_and(new_mask, in_mask, cpus_allowed);
+ hk_mask = housekeeping_cpumask(HK_FLAG_DOMAIN);
+
+ /*
+ * Warn if the cpumask provided has CPUs that are part of isolated and
+ * housekeeping_cpumask
+ */
+ if (!cpumask_subset(new_mask, hk_mask) &&
+ cpumask_intersects(new_mask, hk_mask))
+ pr_warn("pid %d: Mix of isolcpus and non-isolcpus provided\n",
+ p->pid);

/*
* Since bandwidth control happens on root_domain basis,
--
1.8.3.1
\
 
 \ /
  Last update: 2018-10-25 20:43    [W:0.050 / U:0.540 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site