public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
	Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [pagevec] resize pagevec to O(lg(NR_CPUS))
Date: Sun, 12 Sep 2004 01:57:16 -0700	[thread overview]
Message-ID: <20040912085716.GI2660@holomorphy.com> (raw)
In-Reply-To: <20040912071948.GH2660@holomorphy.com>

On Sun, Sep 12, 2004 at 12:19:48AM -0700, William Lee Irwin III wrote:
> Sorry, 4*lg(NR_CPUS) is 64 when lg(NR_CPUS) = 16, or 65536 cpus. 512x
> Altixen would have 4*lg(512) = 4*9 = 36. The 4*lg(NR_CPUS) sizing was
> rather conservative on behalf of users of stack-allocated pagevecs.

And for the extra multiplications, that's a pagevec 296B in size, and
touching 36 page structure cachelines, or 2304B with a 64B cacheline,
4608B for a 128B cacheline, etc. and that even with a ridiculously
large number of cpus. A more involved batching factor may make
sense, though. e.g. 2**(2.5*sqrt(lg(NR_CPUS)) - 1) or some such to
get 4 -> 6, 9 -> 11, 16 -> 16, 25 -> 21, 36 -> 26, 49 -> 31, 64 -> 35,
81 -> 40, 100 -> 44, 121 -> 48, 144 -> 52, 169 -> 56, 196 -> 60,
225 -> 64, 256 -> 68, 289 -> 71, 324 -> 75, 361 -> 79, 400 -> 82,
441 -> 86, 484 -> 89, 529 -> 92, 576 -> 96, 625 -> 99, 676 -> 102,
729 -> 105, 784 -> 108, 841 -> 111, 900 -> 114, 961 -> 117, 1024 -> 120
etc., which looks like a fairly good tradeoff between growth with
NR_CPUS and various limits. I can approximate this well enough in the
preprocessor, but it would be somewhat more obscure than 4*lg(NR_CPUS)
(basically nest expansions of sufficiently rapidly convergent series
and use some functional relations to transform arguments into areas of
rapid convergence), but I suspect we should explore differentiating
between on-stack rapid-fire usage and longer-term amortization if we
must adapt so precisely rather than tuning a global PAGEVEC_SIZE to death.


-- wli

  parent reply	other threads:[~2004-09-12  8:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-09 16:39 [PATCH] cacheline align pagevec structure Marcelo Tosatti
2004-09-09 22:49 ` Andrew Morton
2004-09-09 21:41   ` Marcelo Tosatti
2004-09-09 23:20     ` Andrew Morton
2004-09-09 22:52 ` Andrew Morton
2004-09-09 23:09   ` William Lee Irwin III
2004-09-09 22:12     ` Marcelo Tosatti
2004-09-09 23:59       ` William Lee Irwin III
2004-09-09 23:22     ` Andrew Morton
2004-09-10  0:07       ` [pagevec] resize pagevec to O(lg(NR_CPUS)) William Lee Irwin III
2004-09-10  4:56         ` Nick Piggin
2004-09-10  4:59           ` Nick Piggin
2004-09-10 17:49           ` Marcelo Tosatti
2004-09-12  0:29             ` Nick Piggin
2004-09-12  5:23               ` William Lee Irwin III
2004-09-12  4:36                 ` Nick Piggin
2004-09-12  4:56             ` William Lee Irwin III
2004-09-12  4:28               ` Nick Piggin
2004-09-12  6:27                 ` William Lee Irwin III
2004-09-12  6:03                   ` Nick Piggin
2004-09-12  7:19                     ` William Lee Irwin III
2004-09-12  7:42                       ` Andrew Morton
2004-09-14  2:18                         ` William Lee Irwin III
2004-09-14  2:57                           ` Andrew Morton
2004-09-14  3:12                             ` William Lee Irwin III
2004-09-12  8:57                       ` William Lee Irwin III [this message]
2004-09-13 22:21                 ` Marcelo Tosatti
2004-09-14  1:59                   ` Nick Piggin

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=20040912085716.GI2660@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=nickpiggin@yahoo.com.au \
    /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