>>> On 27.02.15 at 15:54, <dario.faggi...@citrix.com> wrote: > On Fri, 2015-02-27 at 10:50 +0000, Jan Beulich wrote: >> >>> On 27.02.15 at 11:04, <dario.faggi...@citrix.com> wrote: >> > On Fri, 2015-02-27 at 08:46 +0000, Jan Beulich wrote: >> >> I'm simply adjusting what sched_init_vcpu() did, which is alter >> >> hard affinity conditionally on is_pinned and soft affinity >> >> unconditionally. >> >> >> > Ok, I understand the idea behing this better now, thanks. >> > [...] >> > Setting soft affinity as a superset of (in the former case) or equal to >> > (in the latter) hard affinity is just pure overhead, when in the >> > scheduler. >> >> The why does sched_init_vcpu() do what it does? If you want to >> alter that, I'm fine with altering it here. >> > It does that, but, in there, soft affinity is unconditionally set to > 'all bits set'. Then, in the scheduler, if we find out that the the soft > affinity mask is fully set, we just skip the soft affinity balancing > step. > > The idea is that, whether the mask is full because no one touched this > default, or because it has been manually set like that, there is nothing > to do at the soft affinity balancing level.
In that case I think __vcpu_has_soft_affinity() simply isn't general enough: Along with checking whether all bits are set in the soft affinity, it should also check whether soft is a subset of hard (or the passed in second mask). And really it should imo also cover the case where not all bits are set in the mask, but all those corresponding to online CPUs (both of which ought to have the same effect), i.e. whether online CPUs are a subset of soft: static inline int __vcpu_has_soft_affinity(const struct vcpu *vc, const cpumask_t *mask) { return !cpumask_subset(&online_cpu_map, vc->cpu_soft_affinity) && !cpumask_subset(vc->cpu_soft_affinity, vc->cpu_hard_affinity) && cpumask_intersects(vc->cpu_soft_affinity, mask); } That would then leave introducing a "relaxed (or "strict", depending on what we'd like to be the default) mode in the patch here, controlling whether ->cpu_hard_affinity gets overridden (and we'd always override ->cpu_soft_affinity). Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel