linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: gkulkarni@caviumnetworks.com (Ganapatrao Kulkarni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/7] arm64: numa: separate out updates to percpu nodeid and NUMA node cpumap
Date: Wed, 27 Jun 2018 12:24:08 +0530	[thread overview]
Message-ID: <5B333490.7050203@caviumnetworks.com> (raw)
In-Reply-To: <1529327923-17911-3-git-send-email-sudeep.holla@arm.com>



On 06/18/2018 06:48 PM, Sudeep Holla wrote:
>
> Currently numa_clear_node removes both cpu information from the NUMA
> node cpumap as well as the NUMA node id from the cpu. Similarly
> numa_store_cpu_info updates both percpu nodeid and NUMA cpumap.
>
> However we need to retain the numa node id for the cpu and only remove
> the cpu information from the numa node cpumap during CPU hotplug out.
> The same can be extended for hotplugging in the CPU.
>
> This patch separates out numa_{add,remove}_cpu from numa_clear_node and
> numa_store_cpu_info.
>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>   arch/arm64/include/asm/numa.h |  4 ++++
>   arch/arm64/kernel/smp.c       |  2 ++
>   arch/arm64/mm/numa.c          | 29 +++++++++++++++++++++--------
>   3 files changed, 27 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h
> index 01bc46d5b43a..626ad01e83bf 100644
> --- a/arch/arm64/include/asm/numa.h
> +++ b/arch/arm64/include/asm/numa.h
> @@ -35,10 +35,14 @@ void __init numa_set_distance(int from, int to, int distance);
>   void __init numa_free_distance(void);
>   void __init early_map_cpu_to_node(unsigned int cpu, int nid);
>   void numa_store_cpu_info(unsigned int cpu);
> +void numa_add_cpu(unsigned int cpu);
> +void numa_remove_cpu(unsigned int cpu);
>
>   #else  /* CONFIG_NUMA */
>
>   static inline void numa_store_cpu_info(unsigned int cpu) { }
> +static inline void numa_add_cpu(unsigned int cpu) { }
> +static inline void numa_remove_cpu(unsigned int cpu) { }
>   static inline void arm64_numa_init(void) { }
>   static inline void early_map_cpu_to_node(unsigned int cpu, int nid) { }
>
> diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
> index f3e2e3aec0b0..49a021e30dfb 100644
> --- a/arch/arm64/kernel/smp.c
> +++ b/arch/arm64/kernel/smp.c
> @@ -225,6 +225,7 @@ asmlinkage void secondary_start_kernel(void)
>          notify_cpu_starting(cpu);
>
>          store_cpu_topology(cpu);
> +       numa_add_cpu(cpu);
>
>          /*
>           * OK, now it's safe to let the boot CPU continue.  Wait for
> @@ -679,6 +680,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
>          this_cpu = smp_processor_id();
>          store_cpu_topology(this_cpu);
>          numa_store_cpu_info(this_cpu);
> +       numa_add_cpu(this_cpu);
>
>          /*
>           * If UP is mandated by "nosmp" (which implies "maxcpus=0"), don't set
> diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
> index dad128ba98bf..43cc669bc7bc 100644
> --- a/arch/arm64/mm/numa.c
> +++ b/arch/arm64/mm/numa.c
> @@ -70,19 +70,32 @@ EXPORT_SYMBOL(cpumask_of_node);
>
>   #endif
>
> -static void map_cpu_to_node(unsigned int cpu, int nid)
> +static void numa_update_cpu(unsigned int cpu, bool remove)
>   {
> -       set_cpu_numa_node(cpu, nid);
> -       if (nid >= 0)
> +       int nid = cpu_to_node(cpu);
> +
> +       if (nid < 0)
> +               return;
> +
> +       if (remove)
> +               cpumask_clear_cpu(cpu, node_to_cpumask_map[nid]);
> +       else
>                  cpumask_set_cpu(cpu, node_to_cpumask_map[nid]);
>   }
>
> -void numa_clear_node(unsigned int cpu)
> +void numa_add_cpu(unsigned int cpu)
>   {
> -       int nid = cpu_to_node(cpu);
> +       numa_update_cpu(cpu, false);
> +}
>
> -       if (nid >= 0)
> -               cpumask_clear_cpu(cpu, node_to_cpumask_map[nid]);
> +void numa_remove_cpu(unsigned int cpu)
> +{
> +       numa_update_cpu(cpu, true);
> +}
> +
> +void numa_clear_node(unsigned int cpu)
> +{
> +       numa_remove_cpu(cpu);
>          set_cpu_numa_node(cpu, NUMA_NO_NODE);
>   }
>
> @@ -116,7 +129,7 @@ static void __init setup_node_to_cpumask_map(void)
>    */
>   void numa_store_cpu_info(unsigned int cpu)
>   {
> -       map_cpu_to_node(cpu, cpu_to_node_map[cpu]);
> +       set_cpu_numa_node(cpu, cpu_to_node_map[cpu]);
>   }
>
>   void __init early_map_cpu_to_node(unsigned int cpu, int nid)
> --
> 2.7.4
>

changes looks ok to me.
Reviewed-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>

thanks
Ganapat

  reply	other threads:[~2018-06-27  6:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18 13:18 [PATCH v2 0/7] arm64: numa/topology/smp: update the cpumasks for CPU hotplug Sudeep Holla
2018-06-18 13:18 ` [PATCH v2 1/7] arm64: topology: refactor reset_cpu_topology to add support for removing topology Sudeep Holla
2018-06-18 13:18 ` [PATCH v2 2/7] arm64: numa: separate out updates to percpu nodeid and NUMA node cpumap Sudeep Holla
2018-06-27  6:54   ` Ganapatrao Kulkarni [this message]
2018-07-04 13:52   ` Will Deacon
2018-07-04 13:59     ` Sudeep Holla
2018-06-18 13:18 ` [PATCH v2 3/7] arm64: topology: add support to remove cpu topology sibling masks Sudeep Holla
2018-07-04 13:58   ` Will Deacon
2018-07-04 14:11     ` Sudeep Holla
2018-07-04 14:27       ` Will Deacon
2018-07-04 14:30         ` Sudeep Holla
2018-06-18 13:18 ` [PATCH v2 4/7] arm64: topology: restrict updating siblings_masks to online cpus only Sudeep Holla
2018-06-18 13:18 ` [PATCH v2 5/7] arm64: smp: remove cpu and numa topology information when hotplugging out CPU Sudeep Holla
2018-06-18 13:18 ` [PATCH v2 6/7] arm64: topology: rename llc_siblings to align with other struct members Sudeep Holla
2018-06-18 13:18 ` [PATCH v2 7/7] arm64: topology: re-introduce numa mask check for scheduler MC selection Sudeep Holla
2018-06-26  6:50 ` [PATCH v2 0/7] arm64: numa/topology/smp: update the cpumasks for CPU hotplug Hanjun Guo
2018-06-26  9:23   ` Sudeep Holla
2018-06-27  3:51     ` Hanjun Guo
2018-06-27  9:33       ` Sudeep Holla
2018-06-27  5:35 ` Ganapatrao Kulkarni
2018-06-27  9:31   ` Sudeep Holla
2018-07-04 14:00 ` Will Deacon
2018-07-04 14:01   ` Sudeep Holla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5B333490.7050203@caviumnetworks.com \
    --to=gkulkarni@caviumnetworks.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).