linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: David Miller <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-arch@vger.kernel.org
Subject: Re: [rfc] increase struct page size?!
Date: Fri, 18 May 2007 07:12:38 +0200	[thread overview]
Message-ID: <20070518051238.GA7696@wotan.suse.de> (raw)
In-Reply-To: <20070517.214740.51856086.davem@davemloft.net>

On Thu, May 17, 2007 at 09:47:40PM -0700, David Miller wrote:
> From: Nick Piggin <npiggin@suse.de>
> Date: Fri, 18 May 2007 06:08:54 +0200
> 
> > I'd like to be the first to propose an increase to the size of struct page
> > just for the sake of increasing it!
> > 
> > If we add 8 bytes to struct page on 64-bit machines, it becomes 64 bytes,
> > which is quite a nice number for cache purposes.
> > 
> > However we don't have to let those 8 bytes go to waste: we can use them
> > to store the virtual address of the page, which kind of makes sense for
> > 64-bit, because they can likely to use complicated memory models.
> > 
> > I'd say all up this is going to decrease overall cache footprint in 
> > fastpaths, both by reducing text and data footprint of page_address and
> > related operations, and by reducing cacheline footprint of most batched
> > operations on struct pages.
> > 
> > Flame away :)
> 
> I've toyed with this several times on sparc64, and in my experience
> the extra memory reference on page->virtual costs on average about the
> same as the non-power-of-2 pointer arithmetic.

Of course it is likely to be in the same cacheline, however if your L1
cache latency or throughput simply isn't up to it, FLATMEM systems
definitely could just not use ->virtual, but still add the extra padding
in the struct page for performance reasons... then they get to use
power-of-2 arithmetic to boot.

The page->virtual thing is just a bonus (although have you seen what
sort of hoops SPARSEMEM has to go through to find page_address?! It
will definitely be a win on those architectures).

 
> The decision is absolutely arbitrary performance wise, but if you
> consider the memory wastage on enormous systems going without
> page->virtual I think is clearly better.

0.2% of memory, or 2MB per GB. But considering we already use 14MB per
GB for the page structures, it isn't like I'm introducing an order of
magnitude problem.

The real benefit I see comes from cache footprint reduction of operations
on struct page. Consider with a 64 byte cacheline and 56 byte struct page,
then every 8 struct pages, 6 span 2 cachelines (75%). If you consider an
operation like reclaim that uses first and last fields, and assume that
pages are going to end up being random, then you're going to touch 75%
more cachelines.  Ditto for allocating and freeing pages.

--
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>

  reply	other threads:[~2007-05-18  5:12 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-18  4:08 Nick Piggin
2007-05-18  4:47 ` David Miller, Nick Piggin
2007-05-18  5:12   ` Nick Piggin [this message]
2007-05-18  5:22     ` David Miller, Nick Piggin
2007-05-18  5:31       ` Nick Piggin
2007-05-18 18:15     ` Christoph Lameter
2007-05-18  7:19 ` Andrew Morton
2007-05-18  7:32   ` Nick Piggin
2007-05-18  7:43     ` Andrew Morton
2007-05-18  7:59       ` Nick Piggin
2007-05-18  9:42 ` David Howells
2007-05-19  1:30   ` Nick Piggin
2007-05-18 12:06 ` Andi Kleen
2007-05-18 15:42 ` Hugh Dickins
2007-05-19  1:22   ` Nick Piggin
2007-05-19 17:53   ` William Lee Irwin III
2007-05-20 22:50     ` Matthew Wilcox
2007-05-18 18:14 ` Christoph Lameter
2007-05-18 20:37   ` Luck, Tony
2007-05-21  6:28     ` KAMEZAWA Hiroyuki
2007-05-19  1:25   ` Nick Piggin
2007-05-19  2:03     ` [rfc] increase struct page size?! (now sparsemem vmemmap) Christoph Lameter
2007-05-19 15:43       ` Andy Whitcroft
2007-05-19 18:15     ` [rfc] increase struct page size?! William Lee Irwin III
2007-05-19 18:25       ` Christoph Lameter
2007-05-20  4:10         ` Eric Dumazet
2007-05-20 12:56           ` Andi Kleen
2007-05-21 17:08             ` Christoph Lameter
2007-05-22  0:30               ` KAMEZAWA Hiroyuki
2007-05-22  0:38                 ` Christoph Lameter
2007-05-22  0:58                   ` KAMEZAWA Hiroyuki
2007-05-22  9:44                   ` Geert Uytterhoeven
2007-05-19 22:09       ` Andrew Morton
2007-05-20  7:26         ` William Lee Irwin III
2007-05-21  9:12         ` Helge Hafting
2007-05-21  9:45           ` Nick Piggin
2007-05-20  5:22       ` Nick Piggin
2007-05-20  8:46         ` William Lee Irwin III
2007-05-20  9:25           ` Nick Piggin
2007-05-21  8:08             ` William Lee Irwin III
2007-05-21  9:27               ` Nick Piggin
2007-05-21 11:26                 ` William Lee Irwin III
2007-05-22  0:52                   ` Nick Piggin
2007-05-21 22:43                 ` Matt Mackall
2007-05-22  1:08                   ` Nick Piggin
2007-05-22  1:13                     ` Christoph Lameter
2007-05-22  1:39                   ` William Lee Irwin III
2007-05-22  1:57                     ` Nick Piggin
2007-05-22  5:04                       ` William Lee Irwin III
2007-05-22  6:24                         ` Nick Piggin
2007-05-22 10:59                           ` William Lee Irwin III
2007-05-21  9:31               ` Eric Dumazet
2007-05-21 17:06             ` Christoph Lameter
2007-05-20 17:13 ` Andrea Arcangeli

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=20070518051238.GA7696@wotan.suse.de \
    --to=npiggin@suse.de \
    --cc=davem@davemloft.net \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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