From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755237AbcHVS4a (ORCPT ); Mon, 22 Aug 2016 14:56:30 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:57993 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754620AbcHVS42 (ORCPT ); Mon, 22 Aug 2016 14:56:28 -0400 Date: Mon, 22 Aug 2016 20:56:09 +0200 From: Peter Zijlstra To: Eric Dumazet Cc: Paul McKenney , LKML , Ingo Molnar , jiangshanlai@gmail.com, dipankar@in.ibm.com, Andrew Morton , Mathieu Desnoyers , Josh Triplett , Thomas Gleixner , Steven Rostedt , David Howells , dvhart@linux.intel.com, =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , oleg@redhat.com, pranith kumar Subject: Re: [PATCH tip/core/rcu 2/2] documentation: Record reason for rcu_head two-byte alignment Message-ID: <20160822185609.GK10153@twins.programming.kicks-ass.net> References: <20160822151413.GA6337@linux.vnet.ibm.com> <1471878883-6660-2-git-send-email-paulmck@linux.vnet.ibm.com> <20160822162553.GJ10153@twins.programming.kicks-ass.net> <20160822173453.GF3482@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 22, 2016 at 11:48:53AM -0700, Eric Dumazet wrote: > On Mon, Aug 22, 2016 at 10:34 AM, Paul E. McKenney > wrote: > > > 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)); > > Don't we have __alignof__(void *) to avoid #ifdef CONFIG_M68K and > other new macros ? Yes, but that 'hides' the m68k funny, while doing an explicit #ifdef has documentation value... but I don't care too deeply.