From: Andrew Morton <akpm@linux-foundation.org>
To: Shaohua Li <shaohua.li@intel.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
"hpa@zytor.com" <hpa@zytor.com>,
sam@ravnborg.org, eric.dumazet@gmail.com
Subject: Re: [patch 1/3]make readmostly section correctly align
Date: Wed, 1 Dec 2010 18:28:54 -0800 [thread overview]
Message-ID: <20101201182854.dd70bdf2.akpm@linux-foundation.org> (raw)
In-Reply-To: <1291255341.12777.115.camel@sli10-conroe>
On Thu, 02 Dec 2010 10:02:21 +0800 Shaohua Li <shaohua.li@intel.com> wrote:
> readmostly section should end at cache line aligned address, otherwise the last
> several data might share cachline with other data and make the readmostly data
> still have cache bounce.
> For example, in ia64, secpath_cachep is the last readmostly data, and it shares
> cacheline with init_uts_ns.
> a000000100e80480 d secpath_cachep
> a000000100e80488 D init_uts_ns
>
> Signed-off-by: Shaohua Li <shaohua.li@intel.com>
>
> ---
> include/asm-generic/vmlinux.lds.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> Index: linux/include/asm-generic/vmlinux.lds.h
> ===================================================================
> --- linux.orig/include/asm-generic/vmlinux.lds.h 2010-12-01 16:49:48.000000000 +0800
> +++ linux/include/asm-generic/vmlinux.lds.h 2010-12-02 09:22:32.000000000 +0800
> @@ -192,7 +192,8 @@
>
> #define READ_MOSTLY_DATA(align) \
> . = ALIGN(align); \
> - *(.data..read_mostly)
> + *(.data..read_mostly) \
> + . = ALIGN(align);
>
> #define CACHELINE_ALIGNED_DATA(align) \
> . = ALIGN(align); \
>
Surely the sane way to do this is to ensure that each section *starts*
at an at-least-cacheline aligned address and then not worry about how
the section ends. So shouldn't we be fixing DATA_DATA?
With your approach, .data may end up sharing a cacheline with
some other section in some undesirable manner on a different arch.
"fixing" DATA_DATA would involve page-aligning it, which sucks a bit.
Things would be better if include/asm-generic/vmlinux.lds.h had access
to a globally-agreed cacheline-size, as it does the page size.
otoh, .data.read_mostly is "special", in that it wants the tail end of
its last cacheline not to share with any other section. Most other
sections aren't like that.
next prev parent reply other threads:[~2010-12-02 2:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-02 2:02 [patch 1/3]make readmostly section correctly align Shaohua Li
2010-12-02 2:28 ` Andrew Morton [this message]
2010-12-02 2:43 ` Shaohua Li
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=20101201182854.dd70bdf2.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=eric.dumazet@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sam@ravnborg.org \
--cc=shaohua.li@intel.com \
/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