|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 1/2] credit: Limit load balancing to once per millisecond
On 21.09.23 14:23, George Dunlap wrote: The credit scheduler tries as hard as it can to ensure that it always runs scheduling units with positive credit (PRI_TS_UNDER) before running those with negative credit (PRI_TS_OVER). If the next runnable scheduling unit is of priority OVER, it will always run the load balancer, which will scour the system looking for another scheduling unit of the UNDER priority. Unfortunately, as the number of cores on a system has grown, the cost of the work-stealing algorithm has dramatically increased; a recent trace on a system with 128 cores showed this taking over 50 microseconds. Add a parameter, load_balance_ratelimit, to limit the frequency of load balance operations on a given pcpu. Default this to 1 millisecond. Invert the load balancing conditional to make it more clear, and line up more closely with the comment above it. Overall it might be cleaner to have the last_load_balance checking happen inside csched_load_balance(), but that would require either passing both now and spc into the function, or looking them up again; both of which seemed to be worse than simply checking and setting the values before calling it. On a system with a vcpu:pcpu ratio of 2:1, running Windows guests (which will end up calling YIELD during spinlock contention), this patch increased performance significantly. Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxx> --- Changes since v1: - Fix editing mistake in commit message - Improve documentation - global var is __ro_after_init - Remove sysctl, as it's not used. Define max value in credit.c. - Fix some style issues - Move comment tweak to the right patch - In the event that the commandline-parameter value is too high, clip to the maximum value rather than setting to the default. CC: Dario Faggioli <dfaggioli@xxxxxxxx> CC: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CC: George Dunlap <george.dunlap@xxxxxxxxxx> CC: Jan Beulich <jbeulich@xxxxxxxx> CC: Julien Grall <julien@xxxxxxx> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx> CC: Wei Liu <wl@xxxxxxx> --- docs/misc/xen-command-line.pandoc | 8 ++++++ xen/common/sched/credit.c | 47 +++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc index f88e6a70ae..9c3c72a7f9 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -1884,6 +1884,14 @@ By default, Xen will use the INVPCID instruction for TLB management if it is available. This option can be used to cause Xen to fall back to older mechanisms, which are generally slower.+### load-balance-ratelimit+> `= <integer>` + +The minimum interval between load balancing events on a given pcpu, in +microseconds. A value of '0' will disable rate limiting. Maximum +value 1 second. At the moment only credit honors this parameter. +Default 1ms. + ### noirqbalance (x86) > `= <boolean>`diff --git a/xen/common/sched/credit.c b/xen/common/sched/credit.c ^ Just found a style issue (after Andrew pointing out the ones in patch 2). My R-b stands with that fixed. Juergen Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc Attachment:
OpenPGP_signature.asc
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |