All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Daniel Phillips <phillips@phunq.net>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	David Miller <davem@davemloft.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Daniel Phillips <phillips@google.com>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	Christoph Lameter <clameter@sgi.com>,
	Matt Mackall <mpm@selenic.com>,
	Lee Schermerhorn <Lee.Schermerhorn@hp.com>,
	Steve Dickson <SteveD@redhat.com>
Subject: Re: [PATCH 00/10] foundations for reserve-based allocation
Date: Mon, 06 Aug 2007 20:17:28 +0200	[thread overview]
Message-ID: <1186424248.11797.66.camel@lappy> (raw)
In-Reply-To: <200708061035.18742.phillips@phunq.net>

On Mon, 2007-08-06 at 10:35 -0700, Daniel Phillips wrote:
> On Monday 06 August 2007 03:29, Peter Zijlstra wrote:

> > We want a guarantee for N bytes from kmalloc(), this translates to a
> > demand on the slab allocator for 2*N+m (due to the power-of-two
> > nature of kmalloc slabs), where m is the meta-data needed by the
> > allocator itself.
> 
> Where does the 2* come from?  Isn't it exp2(ceil(log2(N + m)))?

Given a size distribution of 2^n the worst slack space is 100% - see how
allocations of (2^m) + 1 will always need 2^(m+1) bytes.

lim_{n -> inf} (2^(n+1)/((2^n)+1)) = 
2^lim_{n -> inf} ((n+1)-n) = 2^1 = 2

> Patch [3/10] adds a new field to struct page.

No it doesn't.

>   I do not think this is 
> necessary.   Allocating a page from reserve does not make it special.  
> All we care about is that the total number of pages taken out of 
> reserve is balanced by the total pages freed by a user of the reserve.

And how do we know a page was taken out of the reserves?

This is done by looking at page->reserve (overload of page->index) and
this value can be destroyed as soon as its observed. It is in a sense an
extra return value.

> We do care about slab fragmentation in the sense that a slab page may be 
> pinned in the slab by an unprivileged allocation and so that page may 
> never be returned to the global page reserve.

A slab page obtained from the reseserve will never serve an object to an
unprivilidged allocation.

>   One way to solve this is 
> to have a per slabpage flag indicating the page came from reserve, and 
> prevent mixing of privileged and unprivileged allocations on such a 
> page.

is done.

> This patch set is _way_ less intimidating than its predecessor.  
> However, I see we have entered the era of sets of patch sets, since it 
> is impossible to understand the need for this allocation infrastructure 
> without reading the dependent network patch set.  Waiting with 
> breathless anticipation.

Yeah, there were some objections to the size of it.


WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Daniel Phillips <phillips@phunq.net>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	David Miller <davem@davemloft.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Daniel Phillips <phillips@google.com>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	Christoph Lameter <clameter@sgi.com>,
	Matt Mackall <mpm@selenic.com>,
	Lee Schermerhorn <Lee.Schermerhorn@hp.com>,
	Steve Dickson <SteveD@redhat.com>
Subject: Re: [PATCH 00/10] foundations for reserve-based allocation
Date: Mon, 06 Aug 2007 20:17:28 +0200	[thread overview]
Message-ID: <1186424248.11797.66.camel@lappy> (raw)
In-Reply-To: <200708061035.18742.phillips@phunq.net>

On Mon, 2007-08-06 at 10:35 -0700, Daniel Phillips wrote:
> On Monday 06 August 2007 03:29, Peter Zijlstra wrote:

> > We want a guarantee for N bytes from kmalloc(), this translates to a
> > demand on the slab allocator for 2*N+m (due to the power-of-two
> > nature of kmalloc slabs), where m is the meta-data needed by the
> > allocator itself.
> 
> Where does the 2* come from?  Isn't it exp2(ceil(log2(N + m)))?

Given a size distribution of 2^n the worst slack space is 100% - see how
allocations of (2^m) + 1 will always need 2^(m+1) bytes.

lim_{n -> inf} (2^(n+1)/((2^n)+1)) = 
2^lim_{n -> inf} ((n+1)-n) = 2^1 = 2

> Patch [3/10] adds a new field to struct page.

No it doesn't.

>   I do not think this is 
> necessary.   Allocating a page from reserve does not make it special.  
> All we care about is that the total number of pages taken out of 
> reserve is balanced by the total pages freed by a user of the reserve.

And how do we know a page was taken out of the reserves?

This is done by looking at page->reserve (overload of page->index) and
this value can be destroyed as soon as its observed. It is in a sense an
extra return value.

> We do care about slab fragmentation in the sense that a slab page may be 
> pinned in the slab by an unprivileged allocation and so that page may 
> never be returned to the global page reserve.

A slab page obtained from the reseserve will never serve an object to an
unprivilidged allocation.

>   One way to solve this is 
> to have a per slabpage flag indicating the page came from reserve, and 
> prevent mixing of privileged and unprivileged allocations on such a 
> page.

is done.

> This patch set is _way_ less intimidating than its predecessor.  
> However, I see we have entered the era of sets of patch sets, since it 
> is impossible to understand the need for this allocation infrastructure 
> without reading the dependent network patch set.  Waiting with 
> breathless anticipation.

Yeah, there were some objections to the size of it.

--
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-08-06 18:19 UTC|newest]

Thread overview: 166+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-06 10:29 [PATCH 00/10] foundations for reserve-based allocation Peter Zijlstra
2007-08-06 10:29 ` Peter Zijlstra
2007-08-06 10:29 ` [PATCH 01/10] mm: gfp_to_alloc_flags() Peter Zijlstra
2007-08-06 10:29   ` Peter Zijlstra
2007-08-06 10:29 ` [PATCH 02/10] mm: system wide ALLOC_NO_WATERMARK Peter Zijlstra
2007-08-06 10:29   ` Peter Zijlstra
2007-08-06 18:11   ` Christoph Lameter
2007-08-06 18:11     ` Christoph Lameter
2007-08-06 18:21     ` Daniel Phillips
2007-08-06 18:21       ` Daniel Phillips
2007-08-06 18:31       ` Peter Zijlstra
2007-08-06 18:31         ` Peter Zijlstra
2007-08-06 18:43         ` Daniel Phillips
2007-08-06 18:43           ` Daniel Phillips
2007-08-06 19:11         ` Christoph Lameter
2007-08-06 19:11           ` Christoph Lameter
2007-08-06 19:31           ` Peter Zijlstra
2007-08-06 19:31             ` Peter Zijlstra
2007-08-06 20:12             ` Christoph Lameter
2007-08-06 20:12               ` Christoph Lameter
2007-08-06 18:42       ` Christoph Lameter
2007-08-06 18:42         ` Christoph Lameter
2007-08-06 18:48         ` Daniel Phillips
2007-08-06 18:48           ` Daniel Phillips
2007-08-06 18:51           ` Christoph Lameter
2007-08-06 18:51             ` Christoph Lameter
2007-08-06 19:15             ` Daniel Phillips
2007-08-06 19:15               ` Daniel Phillips
2007-08-06 20:12             ` Matt Mackall
2007-08-06 20:12               ` Matt Mackall
2007-08-06 20:19               ` Christoph Lameter
2007-08-06 20:19                 ` Christoph Lameter
2007-08-06 20:26                 ` Peter Zijlstra
2007-08-06 21:05                   ` Christoph Lameter
2007-08-06 21:05                     ` Christoph Lameter
2007-08-06 22:59                     ` Daniel Phillips
2007-08-06 22:59                       ` Daniel Phillips
2007-08-06 23:14                       ` Christoph Lameter
2007-08-06 23:14                         ` Christoph Lameter
2007-08-06 23:49                         ` Daniel Phillips
2007-08-06 23:49                           ` Daniel Phillips
2007-08-07 22:18                           ` Christoph Lameter
2007-08-07 22:18                             ` Christoph Lameter
2007-08-08  7:24                             ` Peter Zijlstra
2007-08-08 18:06                               ` Christoph Lameter
2007-08-08 18:06                                 ` Christoph Lameter
2007-08-08  7:37                             ` Daniel Phillips
2007-08-08  7:37                               ` Daniel Phillips
2007-08-08 18:09                               ` Christoph Lameter
2007-08-08 18:09                                 ` Christoph Lameter
2007-08-09 18:41                                 ` Daniel Phillips
2007-08-09 18:41                                   ` Daniel Phillips
2007-08-09 18:49                                   ` Christoph Lameter
2007-08-09 18:49                                     ` Christoph Lameter
2007-08-10  0:17                                     ` Daniel Phillips
2007-08-10  0:17                                       ` Daniel Phillips
2007-08-10  1:48                                       ` Christoph Lameter
2007-08-10  1:48                                         ` Christoph Lameter
2007-08-10  3:34                                         ` Daniel Phillips
2007-08-10  3:34                                           ` Daniel Phillips
2007-08-10  3:48                                           ` Christoph Lameter
2007-08-10  3:48                                             ` Christoph Lameter
2007-08-10  8:15                                             ` Daniel Phillips
2007-08-10  8:15                                               ` Daniel Phillips
2007-08-10 17:46                                               ` Christoph Lameter
2007-08-10 17:46                                                 ` Christoph Lameter
2007-08-10 23:25                                                 ` Daniel Phillips
2007-08-10 23:25                                                   ` Daniel Phillips
2007-08-13  6:55                                                 ` Daniel Phillips
2007-08-13  6:55                                                   ` Daniel Phillips
2007-08-13 23:04                                                   ` Christoph Lameter
2007-08-13 23:04                                                     ` Christoph Lameter
2007-08-06 20:27                 ` Andrew Morton
2007-08-06 20:27                   ` Andrew Morton
2007-08-06 23:16                   ` Daniel Phillips
2007-08-06 23:16                     ` Daniel Phillips
2007-08-06 22:47                 ` Daniel Phillips
2007-08-06 22:47                   ` Daniel Phillips
2007-08-06 10:29 ` [PATCH 03/10] mm: tag reseve pages Peter Zijlstra
2007-08-06 10:29   ` Peter Zijlstra
2007-08-06 18:11   ` Christoph Lameter
2007-08-06 18:11     ` Christoph Lameter
2007-08-06 18:13     ` Daniel Phillips
2007-08-06 18:13       ` Daniel Phillips
2007-08-06 18:28     ` Peter Zijlstra
2007-08-06 18:28       ` Peter Zijlstra
2007-08-06 19:34     ` Andi Kleen
2007-08-06 19:34       ` Andi Kleen
2007-08-06 18:43       ` Christoph Lameter
2007-08-06 18:43         ` Christoph Lameter
2007-08-06 18:47         ` Peter Zijlstra
2007-08-06 18:47           ` Peter Zijlstra
2007-08-06 18:59           ` Andi Kleen
2007-08-06 18:59             ` Andi Kleen
2007-08-06 19:09             ` Christoph Lameter
2007-08-06 19:09               ` Christoph Lameter
2007-08-06 19:10             ` Andrew Morton
2007-08-06 19:10               ` Andrew Morton
2007-08-06 19:16               ` Christoph Lameter
2007-08-06 19:16                 ` Christoph Lameter
2007-08-06 19:38               ` Matt Mackall
2007-08-06 19:38                 ` Matt Mackall
2007-08-06 20:18               ` Andi Kleen
2007-08-06 20:18                 ` Andi Kleen
2007-08-06 10:29 ` [PATCH 04/10] mm: slub: add knowledge of reserve pages Peter Zijlstra
2007-08-06 10:29   ` Peter Zijlstra
2007-08-08  0:13   ` Christoph Lameter
2007-08-08  0:13     ` Christoph Lameter
2007-08-08  1:44     ` Matt Mackall
2007-08-08  1:44       ` Matt Mackall
2007-08-08 17:13       ` Christoph Lameter
2007-08-08 17:13         ` Christoph Lameter
2007-08-08 17:39         ` Andrew Morton
2007-08-08 17:39           ` Andrew Morton
2007-08-08 17:57           ` Christoph Lameter
2007-08-08 17:57             ` Christoph Lameter
2007-08-08 18:46             ` Andrew Morton
2007-08-08 18:46               ` Andrew Morton
2007-08-10  1:54               ` Daniel Phillips
2007-08-10  1:54                 ` Daniel Phillips
2007-08-10  2:01                 ` Christoph Lameter
2007-08-10  2:01                   ` Christoph Lameter
2007-08-20  7:38   ` Peter Zijlstra
2007-08-20  7:43     ` Peter Zijlstra
2007-08-20  7:43       ` Peter Zijlstra
2007-08-20  9:12     ` Pekka J Enberg
2007-08-20  9:12       ` Pekka J Enberg
2007-08-20  9:17       ` Peter Zijlstra
2007-08-20  9:28         ` Pekka Enberg
2007-08-20  9:28           ` Pekka Enberg
2007-08-20 19:26           ` Christoph Lameter
2007-08-20 19:26             ` Christoph Lameter
2007-08-20 20:08             ` Peter Zijlstra
2007-08-20 20:08               ` Peter Zijlstra
2007-08-06 10:29 ` [PATCH 05/10] mm: allow mempool to fall back to memalloc reserves Peter Zijlstra
2007-08-06 10:29   ` Peter Zijlstra
2007-08-06 10:29 ` [PATCH 06/10] mm: kmem_estimate_pages() Peter Zijlstra
2007-08-06 10:29   ` Peter Zijlstra
2007-08-06 10:29 ` [PATCH 07/10] mm: allow PF_MEMALLOC from softirq context Peter Zijlstra
2007-08-06 10:29   ` Peter Zijlstra
2007-08-06 10:29 ` [PATCH 08/10] mm: serialize access to min_free_kbytes Peter Zijlstra
2007-08-06 10:29   ` Peter Zijlstra
2007-08-06 10:29 ` [PATCH 09/10] mm: emergency pool Peter Zijlstra
2007-08-06 10:29   ` Peter Zijlstra
2007-08-06 10:29 ` [PATCH 10/10] mm: __GFP_MEMALLOC Peter Zijlstra
2007-08-06 10:29   ` Peter Zijlstra
2007-08-06 17:35 ` [PATCH 00/10] foundations for reserve-based allocation Daniel Phillips
2007-08-06 17:35   ` Daniel Phillips
2007-08-06 18:17   ` Peter Zijlstra [this message]
2007-08-06 18:17     ` Peter Zijlstra
2007-08-06 18:40     ` Daniel Phillips
2007-08-06 18:40       ` Daniel Phillips
2007-08-06 19:31     ` Daniel Phillips
2007-08-06 19:31       ` Daniel Phillips
2007-08-06 19:36       ` Peter Zijlstra
2007-08-06 19:36         ` Peter Zijlstra
2007-08-06 19:53         ` Daniel Phillips
2007-08-06 19:53           ` Daniel Phillips
2007-08-06 17:56 ` Christoph Lameter
2007-08-06 17:56   ` Christoph Lameter
2007-08-06 18:33   ` Peter Zijlstra
2007-08-06 18:33     ` Peter Zijlstra
2007-08-06 20:23 ` Matt Mackall
2007-08-06 20:23   ` Matt Mackall
2007-08-07  0:09   ` Daniel Phillips
2007-08-07  0:09     ` Daniel Phillips

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=1186424248.11797.66.camel@lappy \
    --to=a.p.zijlstra@chello.nl \
    --cc=Lee.Schermerhorn@hp.com \
    --cc=SteveD@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mpm@selenic.com \
    --cc=penberg@cs.helsinki.fi \
    --cc=phillips@google.com \
    --cc=phillips@phunq.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.