And diff-sched-fix-sched_getaffinity-on-unexisting-tasks-inside-VE,
which is a quickfix for the original patch.

Author: Kirill Tkhai
Email: [email protected]
Subject: sched: Return only virtual cpus in sched_getaffinity()
Date: Mon, 28 Apr 2014 12:45:38 +0400

Fill mask using virtual cpus which are enumerated
from 0 to num_online_vcpus()-1.

Just in pair to /proc/cpuinfo and sched_setaffinity().

https://jira.sw.ru/browse/PSBM-25367

v2: Simplification

Signed-off-by: Kirill Tkhai <[email protected]>
Acked-by: Vladimir Davydov <[email protected]>

An addition by khorenko@:
"nproc" utility works via sched_getaffinity().
=============================================================================

Author: Kirill Tkhai
Email: [email protected]
Subject: sched: Fix sched_getaffinity() on unexisting tasks
Date: Wed, 4 Jun 2014 14:33:26 +0400

Move !ve0 block after process search to be able to fail if
there is no process with the given pid inside CT.

https://jira.sw.ru/browse/PSBM-27200

Signed-off-by: Kirill Tkhai <[email protected]>
Acked-by: Cyrill Gorcunov <[email protected]>
=============================================================================

Related to https://jira.sw.ru/browse/PSBM-33642

Signed-off-by: Vladimir Davydov <[email protected]>
---
 kernel/sched/core.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d8831c91bebb..0e8c92152cb9 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4644,6 +4644,12 @@ long sched_getaffinity(pid_t pid, struct cpumask *mask)
        if (retval)
                goto out_unlock;
 
+       if (!ve_is_super(get_exec_env())) {
+               cpumask_clear(mask);
+               bitmap_fill(cpumask_bits(mask), num_online_vcpus());
+               goto out_unlock;
+       }
+
        raw_spin_lock_irqsave(&p->pi_lock, flags);
        cpumask_and(mask, &p->cpus_allowed, cpu_active_mask);
        raw_spin_unlock_irqrestore(&p->pi_lock, flags);
-- 
2.1.4

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to