mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: george anzinger <george@mvista.com>
To: Joe Korty <joe.korty@ccur.com>
Cc: akpm@digeo.com, torvalds@transmeta.com, jim.houston@ccur.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] An O1, nonrecursive ID allocator for Posix timers
Date: Wed, 18 Dec 2002 13:50:02 -0800	[thread overview]
Message-ID: <3E00ED8A.B63B8A9D@mvista.com> (raw)
In-Reply-To: <200212181553.PAA04992@rudolph.ccur.com>

Joe Korty wrote:
> 
> Hi George, Andrew, Linus, Jim, Everyone,
> 
> This is a drop-in replacement for the ID allocator that Jim Houston
> wrote to support posix timers.  The inspiration for this came from
> Andrew Morton's desire for a recursion-free allocator; in addition I
> have made it O(1) while preserving the no-upper-limits-except-memory
> attribute of the original.
> 
> I (actually Jim) spot-tested this with Jim's posix timers patch as
> the base.  It passed a run of George's timers test suite
> (http://sourceforge.net/projects/high-res-timers) and the timer
> portion of the posix test suite (http://posixtest.sourceforge.net/).
> 
> To play with, apply Jim's posix timer patch to 2.5.51 and then delete
> 
>     kernel/id2ptr.c
>     include/linux/id2ptr.h
> 
> then apply this patch.
> 
> This procedure might also work against George's timers patch, as he is
> using the same ID allocator as Jim.
> 
> Jim's timer patch may be found at:
>     http://marc.theaimsgroup.com/?l=linux-kernel&m=104006731324824&q=raw
> 
> George's timer patch may be found at:
>     http://sourceforge.net/projects/high-res-timers
> 
A few comments:

I have found that the locking needs on lookup require that
the object be locked before the id-look-up is unlocked. 
With out this it is possible to find an object and have it
"removed" by another prior to getting it locked.  This is
why, in my version, the lock is exported.  I am considering
removing the locking from the id code entirely.  The
radix-tree code does it this way.  Another issue with
locking is the irq required or not thing.  Irq locking is
VERY expensive and getting more so as cpu speeds go up and
I/O speeds stay the same.  If it is not needed, it is best
not to use it.  Again, exporting the locking to the caller
seems the best answer.

I would much prefer to return memory on release.  In my code
I currently only return the leaf nodes, but I consider this
something to be fixed rather than a feature.

While the code is order 1 it does do a divide which, as I
understand it, is rather expensive (risc machines do them
with subroutines).  It is rather easy to eliminate the
recursion in an radix-tree AND avoid the div at the same
time.

I would consider moving the "ctr" member to the root of the
tree and using the same one for all allocations.  I may be
wrong here, but I think it gives a better cycle time for the
bits used.
-- 
George Anzinger   george@mvista.com
High-res-timers: 
http://sourceforge.net/projects/high-res-timers/
Preemption patch:
http://www.kernel.org/pub/linux/kernel/people/rml

  reply	other threads:[~2002-12-18 21:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-18 15:53 Joe Korty
2002-12-18 21:50 ` george anzinger [this message]
2002-12-19 14:08   ` Joe Korty
2002-12-19 18:38     ` george anzinger

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=3E00ED8A.B63B8A9D@mvista.com \
    --to=george@mvista.com \
    --cc=akpm@digeo.com \
    --cc=jim.houston@ccur.com \
    --cc=joe.korty@ccur.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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