[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0000013ad12afc1c-ceb72c4a-b0f2-4e79-8b09-9d7b716ce06b-000000@email.amazonses.com>
Date: Mon, 5 Nov 2012 15:23:06 +0000
From: Christoph Lameter <cl@...ux.com>
To: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
cc: Shan Wei <shanwei88@...il.com>, dipankar@...ibm.com,
Kernel-Maillist <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 6/9] rcu: use __this_cpu_read helper instead of
per_cpu_ptr(p, raw_smp_processor_id())
On Sat, 3 Nov 2012, Paul E. McKenney wrote:
> OK, I do understand why it happens to work. My question is instead why
> it is considered a good idea. After all, it is the ->rda field that is
> marked __percpu, not the ->mynode field. So in the interest of
> mechanical checking and general readability, it seems to me that it
> would be way better to apply __this_cpu_read() to rsp->rda rather than
> to rsp->rda->mynode.
mynode is part of the structure reached via rda.
Use on rsp->rda does not work since the offset of mynode must be added to
rda before a fetch related to the current cpus per cpu address can be
done.
this_cpu_ptr relocates and address. this_cpu_read() relocates the address
and performs the fetch. If you want to operate on rda then you can only
use this_cpu_ptr. this_cpu_read() saves you more instructions since it can
do the relocation and the fetch in one instruction.
--
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