[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170208181932.GA25826@htj.duckdns.org>
Date: Wed, 8 Feb 2017 13:19:32 -0500
From: Tejun Heo <htejun@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: kbuild test robot <lkp@...el.com>,
Michal Hocko <mhocko@...nel.org>, kbuild-all@...org,
Mel Gorman <mgorman@...e.de>, Vlastimil Babka <vbabka@...e.cz>,
Hillf Danton <hillf.zj@...baba-inc.com>, linux-mm@...ck.org,
LKML <linux-kernel@...r.kernel.org>,
Michal Hocko <mhocko@...e.com>
Subject: Re: [PATCH]
mm-page_alloc-use-static-global-work_struct-for-draining-per-cpu-pages-fix
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
Powered by blists - more mailing lists