Re: [rfc] increase struct page size?!

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: William Lee Irwin III
Date: Monday, May 21, 2007 - 1:08 am

On Sun, May 20, 2007 at 01:46:47AM -0700, William Lee Irwin III wrote:

On Sun, May 20, 2007 at 11:25:52AM +0200, Nick Piggin wrote:

Choosing k distinct integers (mem_map array indices) from the interval
[0,n-1] results in k(n-k+1)/n non-adjacent intervals of contiguous
array indices on average. The average interval length is
(n+1)/(n-k+1) - 1/C(n,k). Alignment considerations make going much
further somewhat hairy, but it should be clear that contiguity arising
from random choice is non-negligible.

In any event, I don't have all that much of an objection to what's
actually proposed, just this particular cache footprint argument.
One can motivate increases in sizeof(struct page), but not this way.

Now that I've been informed of the ->_count and ->_mapcount issues,
I'd say that they're grave and should be corrected even at the cost
of sizeof(struct page).


-- wli

Many thanks to int-e on EfNet #math for help with the calculations
(perhaps better described as doing them outright).
Heavily-edited IRC log (using Knuth's conventions for M, N, and k as
	the number of runs):

<int-e:#math> wli: oh maybe this can be solved exactly after all. The number
+of configurations of N numbers out of M with exactly k runs is C(N-1, k-1) *
+C(M-N+1, k). When there are k runs, the average run length is N/k, obviously.
<int-e:#math> wli: assume there are k runs. add an empty dummy element at the
+end and at the front - then you have (k+1) empty runs between the k runs.
+Every run has positive length. the empty runs correspond to a partition of
+M-N+2 into k+1 positive numbers, and the occupied runs correspond to one of N
+into k positive numbers, which gives that formula.
<int-e:#math> wli: So the average is 1/C(M,N) * sum[k=1 to N] N/k C(N-1,k-1)
+C(M-N+1,k) = 1/C(M,N) * sum[k=1 to N] C(N,k) C(M-N+1,k) = 1/C(M,N) * (C(M+1,
+N) - 1) = (M+1)/(M-N+1) - 1/C(M,N).
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[rfc] increase struct page size?!, Nick Piggin, (Thu May 17, 9:08 pm)
Re: [rfc] increase struct page size?!, David Miller, (Thu May 17, 9:47 pm)
Re: [rfc] increase struct page size?!, Nick Piggin, (Thu May 17, 10:12 pm)
Re: [rfc] increase struct page size?!, David Miller, (Thu May 17, 10:22 pm)
Re: [rfc] increase struct page size?!, Nick Piggin, (Thu May 17, 10:31 pm)
Re: [rfc] increase struct page size?!, Andrew Morton, (Fri May 18, 12:19 am)
Re: [rfc] increase struct page size?!, Nick Piggin, (Fri May 18, 12:32 am)
Re: [rfc] increase struct page size?!, Andrew Morton, (Fri May 18, 12:43 am)
Re: [rfc] increase struct page size?!, Nick Piggin, (Fri May 18, 12:59 am)
Re: [rfc] increase struct page size?!, David Howells, (Fri May 18, 2:42 am)
Re: [rfc] increase struct page size?!, Andi Kleen, (Fri May 18, 5:06 am)
Re: [rfc] increase struct page size?!, Hugh Dickins, (Fri May 18, 8:42 am)
Re: [rfc] increase struct page size?!, Christoph Lameter, (Fri May 18, 11:14 am)
Re: [rfc] increase struct page size?!, Christoph Lameter, (Fri May 18, 11:15 am)
RE: [rfc] increase struct page size?!, Luck, Tony, (Fri May 18, 1:37 pm)
Re: [rfc] increase struct page size?!, Nick Piggin, (Fri May 18, 6:22 pm)
Re: [rfc] increase struct page size?!, Nick Piggin, (Fri May 18, 6:25 pm)
Re: [rfc] increase struct page size?!, Nick Piggin, (Fri May 18, 6:30 pm)
Re: [rfc] increase struct page size?! (now sparsemem vmemmap), Christoph Lameter, (Fri May 18, 7:03 pm)
Re: [rfc] increase struct page size?!, William Lee Irwin III, (Sat May 19, 10:53 am)
Re: [rfc] increase struct page size?!, William Lee Irwin III, (Sat May 19, 11:15 am)
Re: [rfc] increase struct page size?!, Christoph Lameter, (Sat May 19, 11:25 am)
Re: [rfc] increase struct page size?!, Andrew Morton, (Sat May 19, 3:09 pm)
Re: [rfc] increase struct page size?!, Eric Dumazet, (Sat May 19, 9:10 pm)
Re: [rfc] increase struct page size?!, Nick Piggin, (Sat May 19, 10:22 pm)
Re: [rfc] increase struct page size?!, William Lee Irwin III, (Sun May 20, 12:26 am)
Re: [rfc] increase struct page size?!, William Lee Irwin III, (Sun May 20, 1:46 am)
Re: [rfc] increase struct page size?!, Nick Piggin, (Sun May 20, 2:25 am)
Re: [rfc] increase struct page size?!, Andi Kleen, (Sun May 20, 5:56 am)
Re: [rfc] increase struct page size?!, Andrea Arcangeli, (Sun May 20, 10:13 am)
Re: [rfc] increase struct page size?!, Matthew Wilcox, (Sun May 20, 3:50 pm)
Re: [rfc] increase struct page size?!, KAMEZAWA Hiroyuki, (Sun May 20, 11:28 pm)
Re: [rfc] increase struct page size?!, William Lee Irwin III, (Mon May 21, 1:08 am)
Re: [rfc] increase struct page size?!, Helge Hafting, (Mon May 21, 2:12 am)
Re: [rfc] increase struct page size?!, Nick Piggin, (Mon May 21, 2:27 am)
Re: [rfc] increase struct page size?!, Eric Dumazet, (Mon May 21, 2:31 am)
Re: [rfc] increase struct page size?!, Nick Piggin, (Mon May 21, 2:45 am)
Re: [rfc] increase struct page size?!, William Lee Irwin III, (Mon May 21, 4:26 am)
Re: [rfc] increase struct page size?!, Christoph Lameter, (Mon May 21, 10:06 am)
Re: [rfc] increase struct page size?!, Christoph Lameter, (Mon May 21, 10:08 am)
Re: [rfc] increase struct page size?!, Matt Mackall, (Mon May 21, 3:43 pm)
Re: [rfc] increase struct page size?!, KAMEZAWA Hiroyuki, (Mon May 21, 5:30 pm)
Re: [rfc] increase struct page size?!, Christoph Lameter, (Mon May 21, 5:38 pm)
Re: [rfc] increase struct page size?!, Nick Piggin, (Mon May 21, 5:52 pm)
Re: [rfc] increase struct page size?!, KAMEZAWA Hiroyuki, (Mon May 21, 5:58 pm)
Re: [rfc] increase struct page size?!, Nick Piggin, (Mon May 21, 6:08 pm)
Re: [rfc] increase struct page size?!, Christoph Lameter, (Mon May 21, 6:13 pm)
Re: [rfc] increase struct page size?!, William Lee Irwin III, (Mon May 21, 6:39 pm)
Re: [rfc] increase struct page size?!, Nick Piggin, (Mon May 21, 6:57 pm)
Re: [rfc] increase struct page size?!, William Lee Irwin III, (Mon May 21, 10:04 pm)
Re: [rfc] increase struct page size?!, Geert Uytterhoeven, (Tue May 22, 2:44 am)