From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751179AbdBHSTi (ORCPT ); Wed, 8 Feb 2017 13:19:38 -0500 Received: from mail-yw0-f196.google.com ([209.85.161.196]:34502 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751026AbdBHSTg (ORCPT ); Wed, 8 Feb 2017 13:19:36 -0500 Date: Wed, 8 Feb 2017 13:19:32 -0500 From: Tejun Heo To: Andrew Morton Cc: kbuild test robot , Michal Hocko , kbuild-all@01.org, Mel Gorman , Vlastimil Babka , Hillf Danton , linux-mm@kvack.org, LKML , Michal Hocko Subject: Re: [PATCH] mm-page_alloc-use-static-global-work_struct-for-draining-per-cpu-pages-fix Message-ID: <20170208181932.GA25826@htj.duckdns.org> References: <20170207202755.24571-1-mhocko@kernel.org> <201702080524.R4RBmup3%fengguang.wu@intel.com> <20170207141420.ab4de727ed05ddd41602f73f@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170207141420.ab4de727ed05ddd41602f73f@linux-foundation.org> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Andrew. On Tue, Feb 07, 2017 at 02:14:20PM -0800, Andrew Morton wrote: > > extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ > > ^ > > huh, yes. The DEFINE_PER_CPU() macro is broken. Yeah, that was the trade off I had to take with percpu vars to force s390 and alpha to generate long references (GOT based addressing) for percpu variables; otherwise, they generate memory deref which is too limited to access the special percpu addresses. It's explained in include/linux/percpu-defs.h. > If you do > > foo() > { > static DEFINE_PER_CPU(int, bar); > } > > then it won't compile, as described here. It should. > > And if you do > > static DEFINE_PER_CPU(int, bar); > > then you still get global symbols (__pcpu_unique_bar). > > The kernel does the above thing in, umm, 466 places and afaict they're > all broken. If two code sites ever use the same identifier, they'll > get linkage errors. So, we have CONFIG_DEBUG_FORCE_WEAK_PER_CPU to catch those cases on archs other than s390 or alpha. > huh. Seems hard to fix. This was the only way I could come up with to support alpha and s390. All the restrictions are there to ensure that. If we can do s390 and alpha w/o the global weak reference, neither restriction is necessary. Thanks. -- tejun