[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 3/6] xen: sched: clarify use cases of schedule_cpu_switch()



On Fri, 2015-10-30 at 00:04 +0100, Dario Faggioli wrote:
> schedule_cpu_switch() is meant to be only used for moving
> pCPUs from a cpupool to no cpupool, and from there back
> to a cpupool, *not* to move them directly from one cpupool
> to another.
> 
> This is something that is reflected in the way it is
> implemented, and should be kept in mind when looking at
> it. However, that is not that clear, by just the look of
> it.
> 
> Make it more evident by:
>  - adding commentary and ASSERT()s;
>  - update the cpupool per-CPU variable (mapping pCPUs to
>    pools) directly in schedule_cpu_switch(), rather than
>    in various places in cpupool.c.
> 
> Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
> Acked-by: Juergen Gross <jgross@xxxxxxxx>
>
BTW, Juergen, I had the whole series tested with the script below, for
a few hourse, as per your suggestion to help confirming that this patch
is actually correct, as it seems by just looking at the code.

Since everything was fine, I added your Ack, as you said I could.

Regards,
Dario


#!/bin/bash

set -ex
xl cpupool-cpu-remove Pool-0 0,2,4,6,8,10,12,14
xl cpupool-create name=\"Pool-even\" cpus=\"0,2,4,6,8,10,12,14\" 
sched=\"credit\"
xl cpupool-rename Pool-0 Pool-odd

# Switch CPUs between pools
function switchcpus() {
  while true; do
    for i in `seq 0 2 15`; do
      xl cpupool-cpu-remove Pool-even $i
      xl cpupool-cpu-add Pool-odd $i
      xl cpupool-list -c
      sleep $(($RANDOM%5))
      xl cpupool-cpu-remove Pool-odd $i
      xl cpupool-cpu-add Pool-even $i
    done
    for i in `seq 1 2 15`; do
    echo $i
      xl cpupool-cpu-remove Pool-odd $i
      xl cpupool-cpu-add Pool-even $i
      xl cpupool-list -c
      sleep $(($RANDOM%5))
      xl cpupool-cpu-remove Pool-even $i
      xl cpupool-cpu-add Pool-odd $i
    done
    xl cpupool-list -c
  done
}

# Moving a domain between pools
function movedomain() {
  xl create vms/vm1.cfg pool=\"Pool-odd\"
  sleep 10

  while true; do
    xl cpupool-migrate vm1 Pool-even
    sleep $(($RANDOM%10))
    xl cpupool-migrate vm1 Pool-odd
    sleep $(($RANDOM%10))
  done
}

# creating and destroying a domain
function createdestroydomain() {
  while true; do
    xl create vms/vm2.cfg pool=\"Pool-odd\"
    xl list -c
    sleep $((10+$RANDOM%10))
    xl destroy vm2
    sleep $(($RANDOM%5))
    xl create vms/vm2.cfg pool=\"Pool-even\"
    xl list -c
    sleep $((10+$RANDOM%10))
    xl destroy vm2
  done
}

switchcpus &
movedomain &
createdestroydomain &

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.