lkml.org 
[lkml]   [2019]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v7 4/5] locking/qspinlock: Introduce starvation avoidance into CNA
From
Date
On 11/25/19 4:07 PM, Alex Kogan wrote:
> Keep track of the number of intra-node lock handoffs, and force
> inter-node handoff once this number reaches a preset threshold.
> The default value for the threshold can be overridden with
> the new kernel boot command-line option "numa_spinlock_threshold".
>
> Signed-off-by: Alex Kogan <alex.kogan@oracle.com>
> Reviewed-by: Steve Sistare <steven.sistare@oracle.com>
> ---
> .../admin-guide/kernel-parameters.txt | 8 ++++++
> arch/x86/kernel/alternative.c | 27 +++++++++++++++++++
> kernel/locking/qspinlock.c | 3 +++
> kernel/locking/qspinlock_cna.h | 27 ++++++++++++++++---
> 4 files changed, 62 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 904cb32f592d..887fbfce701d 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -3185,6 +3185,14 @@
> Not specifying this option is equivalent to
> numa_spinlock=auto.
>
> + numa_spinlock_threshold= [NUMA, PV_OPS]
> + Set the threshold for the number of intra-node
> + lock hand-offs before the NUMA-aware spinlock
> + is forced to be passed to a thread on another NUMA node.
> + Valid values are in the [0..31] range. Smaller values
> + result in a more fair, but less performant spinlock, and
> + vice versa. The default value is 16.
> +
> cpu0_hotplug [X86] Turn on CPU0 hotplug feature when
> CONFIG_BOOTPARAM_HOTPLUG_CPU0 is off.
> Some features depend on CPU0. Known dependencies are:
> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> index 6a4ccbf4e09c..28552e0491b5 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -723,6 +723,33 @@ static int __init numa_spinlock_setup(char *str)
>
> __setup("numa_spinlock=", numa_spinlock_setup);
>
> +/*
> + * Controls the threshold for the number of intra-node lock hand-offs before
> + * the NUMA-aware variant of spinlock is forced to be passed to a thread on
> + * another NUMA node. By default, the chosen value provides reasonable
> + * long-term fairness without sacrificing performance compared to a lock
> + * that does not have any fairness guarantees.
> + */
> +int intra_node_handoff_threshold = 1 << 16;

      ^
      __ro_after_init

> +
> +static int __init numa_spinlock_threshold_setup(char *str)
> +{
> + int new_threshold_param;
> +
> + if (get_option(&str, &new_threshold_param)) {
> + /* valid value is between 0 and 31 */
> + if (new_threshold_param < 0 || new_threshold_param > 31)
> + return 0;
> +
> + intra_node_handoff_threshold = 1 << new_threshold_param;
> + return 1;
> + }
> +
> + return 0;
> +}
> +
> +__setup("numa_spinlock_threshold=", numa_spinlock_threshold_setup);
> +
> #endif
>

Against, this should be in qspinlock_can.h not in alternative.c.

Cheers,
Longman

\
 
 \ /
  Last update: 2019-12-06 19:10    [W:0.083 / U:7.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site