From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
jiangshanlai@gmail.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, tglx@linutronix.de, rostedt@goodmis.org,
dhowells@redhat.com, edumazet@google.com, dvhart@linux.intel.com,
fweisbec@gmail.com, oleg@redhat.com, bobby.prani@gmail.com
Subject: Re: [PATCH tip/core/rcu 2/2] documentation: Record reason for rcu_head two-byte alignment
Date: Mon, 22 Aug 2016 10:34:53 -0700 [thread overview]
Message-ID: <20160822173453.GF3482@linux.vnet.ibm.com> (raw)
In-Reply-To: <20160822162553.GJ10153@twins.programming.kicks-ass.net>
On Mon, Aug 22, 2016 at 06:25:53PM +0200, Peter Zijlstra wrote:
> On Mon, Aug 22, 2016 at 08:14:43AM -0700, Paul E. McKenney wrote:
> > The __call_rcu() assertion that checks only the bottom bit of the
> > rcu_head pointer is a bit counter-intuitive in these days of ubiquitous
> > 64-bit systems. This commit therefore records the reason for this
> > odd alignment check, namely that m68k guarantees only two-byte alignment
> > despite being a 32-bit architectures.
>
> Would not something like:
>
> #ifdef CONFIG_M68K
> /*
> * m68k is weird and doesn't have naturally aligned types.
> */
> WARN_ON_ONCE((unsigned long)head & 1);
> #else
> WARN_ON_ONCE((unsigned long)head & (sizeof(unsigned long) - 1));
> #endif
>
> Be better?
That does have much to say for itself, though I would prefer sizeof(void
*) to sizeof(unsigned long). But would it make sense to define a mask
on a per-architecture basis, with the default being (sizeof(void *) - 1)?
Then maybe an IMPROPERLY_ALIGNED_POINTER():
#ifndef CONFIG_ARCH_POINTER_ALIGNMENT
#define CONFIG_ARCH_POINTER_ALIGNMENT (sizeof(void *) - 1)
#endif
#define IMPROPERLY_ALIGNED_POINTER(p) \
((p) & CONFIG_ARCH_POINTER_ALIGNMENT)
m68k would define ARCH_POINTER_ALIGNMENT to 1, and all other arches
would leave it undefined.
Then __call_rcu() could to this:
WARN_ON_ONCE(IMPROPERLY_ALIGNED_POINTER(head));
Seem reasonable?
Thanx, Paul
next prev parent reply other threads:[~2016-08-22 17:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-22 15:14 [PATCH tip/core/rcu 0/2] Documentation updates Paul E. McKenney
2016-08-22 15:14 ` [PATCH tip/core/rcu 1/2] rcutorture: Remove outdated config option description Paul E. McKenney
2016-08-22 15:14 ` [PATCH tip/core/rcu 2/2] documentation: Record reason for rcu_head two-byte alignment Paul E. McKenney
2016-08-22 16:25 ` Peter Zijlstra
2016-08-22 17:34 ` Paul E. McKenney [this message]
2016-08-22 18:48 ` Eric Dumazet
2016-08-22 18:56 ` Peter Zijlstra
2016-08-22 19:18 ` Steven Rostedt
2016-08-22 19:54 ` Paul E. McKenney
2016-08-22 20:48 ` Geert Uytterhoeven
2016-08-22 21:16 ` Paul E. McKenney
2016-08-23 6:39 ` Geert Uytterhoeven
2016-08-23 13:43 ` Paul E. McKenney
2016-08-23 13:45 ` Geert Uytterhoeven
2016-08-23 14:23 ` Paul E. McKenney
2016-08-23 14:30 ` Geert Uytterhoeven
2016-08-23 14:41 ` Paul E. McKenney
2016-08-24 18:03 ` Kirill A. Shutemov
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=20160822173453.GF3482@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=bobby.prani@gmail.com \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=dvhart@linux.intel.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.