mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ravikiran G Thirumalai <kiran@in.ibm.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andrew Morton <akpm@osdl.org>,
	lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Manfred Spraul <manfred@colorfullife.com>,
	Dipankar Sarma <dipankar@in.ibm.com>
Subject: Re: [patch] mm: Reimplementation of dynamic percpu memory allocator
Date: Fri, 14 Jan 2005 15:28:27 +0530	[thread overview]
Message-ID: <20050114095827.GA3832@in.ibm.com> (raw)
In-Reply-To: <1105669487.7311.11.camel@localhost.localdomain>

On Fri, Jan 14, 2005 at 01:24:47PM +1100, Rusty Russell wrote:
> On Thu, 2005-01-13 at 14:04 +0530, Ravikiran G Thirumalai wrote:
> > ...
> > 
> > The following patch re-implements the linux dynamic percpu memory allocator
> > so that:
> > 1. Percpu memory dereference is faster 
> > 	- One less memory reference compared to existing simple alloc_percpu
> > 	- As fast as with static percpu areas, one mem ref less actually.
> 
> Hmm, for me one point of a good dynamic per-cpu implementation is that
> the same per_cpu_offset be used as for the static per-cpu variables.
> This means that architectures can put it in a register.  

The allocator I have posted can be easily fixed for that.  In fact, I had a
version which used per_cpu_offset.  My earlier experiments proved that
pointer arithmetic is  marginally faster than the per_cpu_offset
based version.  Also, why waste a register if we can achieve same dereference
speeds without using a register?  But as I said, we can modify the allocator I
posted to use per_cpu_offset.


> It also has
> different properties than slab, because tiny allocations will be more
> common (ie. one counter).


As regards tiny allocations, many existing users of alloc_percpu are
structures which are aggregations of many counters -- like the mib statistics,
disk_stats etc.  So IMHO, dynamic percpu allocator should work well for
both small and large objects.  I have done some user space measurements
with my version and the allocator behaves well with both small and random sized
objects.

The advantages of my implementation as I see it is:
1. Independent of slab/kmalloc
2. Doesn't need arches to do their own node local allocation -- generic
   version does that.
3. Space efficient -- about 98% utilization achieved in userspace tests
4. Allocates pages for cpu_possible cpus only

disadvantage:
1. Uses vmalloc area and hence additional tlb foot print -- but is there a
   better  way to keep node local allocations, simple pointer arithmetic
   and page allocations for cpu_possible cpus only

Thanks,
Kiran

  reply	other threads:[~2005-01-14  9:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-13  8:34 Ravikiran G Thirumalai
2005-01-13  8:57 ` Andrew Morton
2005-01-14 15:05   ` Ravikiran G Thirumalai
2005-01-14  9:34     ` Andrew Morton
2005-01-17 18:27       ` Ravikiran G Thirumalai
2005-01-17 22:11         ` Andrew Morton
2005-01-18  5:59           ` Ravikiran G Thirumalai
2005-01-14  2:24 ` Rusty Russell
2005-01-14  9:58   ` Ravikiran G Thirumalai [this message]
2005-01-14 10:41     ` Rusty Russell

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=20050114095827.GA3832@in.ibm.com \
    --to=kiran@in.ibm.com \
    --cc=akpm@osdl.org \
    --cc=dipankar@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=rusty@rustcorp.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

Powered by JetHome