linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: kbuild test robot <lkp@intel.com>,
	Michal Hocko <mhocko@kernel.org>,
	kbuild-all@01.org, Mel Gorman <mgorman@suse.de>,
	Vlastimil Babka <vbabka@suse.cz>,
	Hillf Danton <hillf.zj@alibaba-inc.com>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH] mm-page_alloc-use-static-global-work_struct-for-draining-per-cpu-pages-fix
Date: Wed, 8 Feb 2017 13:19:32 -0500	[thread overview]
Message-ID: <20170208181932.GA25826@htj.duckdns.org> (raw)
In-Reply-To: <20170207141420.ab4de727ed05ddd41602f73f@linux-foundation.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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      parent reply	other threads:[~2017-02-08 18:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 20:19 [PATCH] mm, page_alloc: do not depend on cpu hotplug locks inside the allocator Michal Hocko
2017-02-07 20:27 ` [PATCH] mm-page_alloc-use-static-global-work_struct-for-draining-per-cpu-pages-fix Michal Hocko
2017-02-07 21:54   ` kbuild test robot
2017-02-07 22:14     ` Andrew Morton
2017-02-08  8:16       ` Michal Hocko
2017-02-08 18:19       ` Tejun Heo [this message]

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=20170208181932.GA25826@htj.duckdns.org \
    --to=htejun@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hillf.zj@alibaba-inc.com \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=mgorman@suse.de \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=vbabka@suse.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).