All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Nick Piggin <npiggin@suse.de>
Cc: Matt Mackall <mpm@selenic.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [rfc][patch] slob: improvements
Date: Fri, 13 Jul 2007 11:27:25 -0700	[thread overview]
Message-ID: <20070713112725.d75acf1d.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20070515233347.GA20468@wotan.suse.de>

On Wed, 16 May 2007 01:33:47 +0200 Nick Piggin wrote:

> On Tue, May 15, 2007 at 10:17:31AM -0500, Matt Mackall wrote:
> > On Tue, May 15, 2007 at 10:43:05AM +0200, Nick Piggin wrote:
> > > This patch goes on top of my previous RCU patch, and has various
> > > improvements for slob I noticed while implementing said patch ;)
> > > 
> > > Comments?
> > 
> > I'm warming to this. Please check that the comment block at the top is
> > still accurate.
> 
> It wasn't, fixed.
> 
> 
...
> 
> Here is an updated version.
> ---
> 
> Improve slob by turning the freelist into a list of pages using struct page
> fields, then each page has a singly linked freelist of slob blocks via a
> pointer in the struct page.
> 
> - The first benefit is that the slob freelists can be indexed by a smaller
>   type (2 bytes, if the PAGE_SIZE is reasonable).
> 
> - Next is that freeing is much quicker because it does not have to traverse
>   the entire freelist. Allocation can be slightly faster too, because we can
>   skip almost-full freelist pages completely.
> 
> - Slob pages are then freed immediately when they become empty, rather than
>   having a periodic timer try to free them. This gives efficiency and memory
>   consumption improvement.
> 
> 
> Then, we don't encode seperate size and next fields into each slob block,
> rather we use the sign bit to distinguish between "size" or "next". Then
> size 1 blocks contain a "next" offset, and others contain the "size" in
> the first unit and "next" in the second unit.
> 
> - This allows minimum slob allocation alignment to go from 8 bytes to 2
>   bytes on 32-bit and 12 bytes to 2 bytes on 64-bit. In practice, it is
>   best to align them to word size, however some architectures (eg. cris)
>   could gain space savings from turning off this extra alignment.
> 
> 
> Then, make kmalloc use its own slob_block at the front of the allocation
> in order to encode allocation size, rather than rely on not overwriting
> slob's existing header block.
> 
> - This reduces kmalloc allocation overhead similarly to alignment reductions.
> 
> - Decouples kmalloc layer from the slob allocator.
> 
> 
> Then, add a page flag specific to slob pages.
> 
> - This means kfree of a page aligned slob block doesn't have to traverse
>   the bigblock list.
> 
> 
> I would get benchmarks, but my test box's network doesn't come up with
> slob before this patch. I think something is timing out. Anyway, things
> are faster after the patch.
> 
> Code size goes up about 1K, however dynamic memory usage _should_ be
> lower even on relatively small memory systems.
> 
> Signed-off-by: Nick Piggin <npiggin@suse.de>
> 
> ---
> Index: linux-2.6/init/Kconfig
> ===================================================================
> --- linux-2.6.orig/init/Kconfig
> +++ linux-2.6/init/Kconfig
> @@ -529,7 +529,7 @@ config SLUB
>  	   way and has enhanced diagnostics.
>  
>  config SLOB
> -	depends on EMBEDDED && !SPARSEMEM
> +	depends on EMBEDDED && !SPARSEMEM && !ARCH_USES_SLAB_PAGE_STRUCT
>  	bool "SLOB (Simple Allocator)"
>  	help
>  	   SLOB replaces the SLAB allocator with a drastically simpler

Is this patch going in?  I have a randconfig (2.6.22) with
CONFIG_SLOB=y
CONFIG_NUMA=y
CONFIG_SMP=y
The kernel build fails with these config symbols set like that.
It looks like SLOB needs that additional
	&& !ARCH_USES_SLAB_PAGE_STRUCT
(or 	&& !SMP)

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

  reply	other threads:[~2007-07-13 18:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-15  8:43 [rfc][patch] slob: improvements Nick Piggin
2007-05-15 15:17 ` Matt Mackall
2007-05-15 23:33   ` Nick Piggin
2007-07-13 18:27     ` Randy Dunlap [this message]
2007-07-13 18:35       ` Matt Mackall
2007-07-13 18:45         ` Andrew Morton

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=20070713112725.d75acf1d.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=npiggin@suse.de \
    /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.