[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130924072845.GC28538@gmail.com>
Date: Tue, 24 Sep 2013 09:28:45 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Christoph Lameter <cl@...ux.com>
Cc: Tejun Heo <tj@...nel.org>, akpm@...uxfoundation.org,
Steven Rostedt <srostedt@...hat.com>,
linux-kernel@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>
Subject: Re: [pchecks v1 2/4] Use raw cpu ops for calls that would trigger
with checks
* Christoph Lameter <cl@...ux.com> wrote:
> These location triggered during testing with KVM.
>
> These are fetches without preemption off where we judged that
> to be more performance efficient or where other means of
> providing synchronization (BH handling) are available.
>
> Signed-off-by: Christoph Lameter <cl@...ux.com>
>
> Index: linux/include/linux/topology.h
> ===================================================================
> --- linux.orig/include/linux/topology.h 2013-09-12 13:26:29.216103951 -0500
> +++ linux/include/linux/topology.h 2013-09-12 13:41:30.762358687 -0500
> @@ -182,7 +182,7 @@ DECLARE_PER_CPU(int, numa_node);
> /* Returns the number of the current Node. */
> static inline int numa_node_id(void)
> {
> - return __this_cpu_read(numa_node);
> + return raw_cpu_read(numa_node);
> }
> #endif
>
> @@ -239,7 +239,7 @@ static inline void set_numa_mem(int node
> /* Returns the number of the nearest Node with memory */
> static inline int numa_mem_id(void)
> {
> - return __this_cpu_read(_numa_mem_);
> + return raw_cpu_read(_numa_mem_);
> }
These are generic primitives used in quite a few places and it can easily
be a bug to use numa_node_id() in a preemptible section - and this patch
would hide that fact.
So the correct way to do it is to have checking in these and to introduce
raw_numa_node_id()/raw_numa_mem_id() and change eventual KVM (and any
other) preemptible-section use of numa_node_id() to raw_numa_node_id() and
explain why it's safe to do it.
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists