All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Houston <jim.houston@attbi.com>
To: akpm@digeo.com, linux-kernel@vger.kernel.org, george@mvista.com
Subject: Re: [PATCH 3/3] High-res-timers part 3 (posix to hrposix) take 20
Date: Mon, 09 Dec 2002 10:24:49 -0500	[thread overview]
Message-ID: <3DF4B5C1.D36D4CCF@attbi.com> (raw)

Andrew Morton wrote:

> Maybe I'm thick, but this whole id_resue layer seems rather obscure.
> 
> As it is being positioned as a general-purpose utility it needs
> API documentation as well as a general description.

Hi Andrew, George, Everyone,

This is derived from my "alternate Posix timers" patch.  It 
was intended to be a general purpose allocator and lookup
for user space ids (e.g. pids, timer_ids, msg_ids).
It uses a radix tree as a sparse array to map a user id value
to a kernel pointer.  In my version it did pid style allocation
avoiding immediate reuse of the same id values.  The goals
were to avoid hardwired limits, be memory efficient and fast.

I got started on this before Ingo did his magic for hashing
pids.  I prototyped in user space and did a quick hack to
make it work in the kernel.  Yes, it uses a recursive approach
for the allocate and remove path.  The recursion is limited 
to only a few levels and the stack frame is tiny.  For example
if there are 1000000 ids it will have 6 levels of recursion.

Here is my version of this interface:

void *id2ptr_lookup(struct id *idp, int id)

	This looks up the user id value in the idp name space
	and returns the associated kernel pointer.

int id2ptr_new(struct id *idp, void *ptr)

	This allocates and returns a new id and stores the 
	ptr value in the sparse array

void id2ptr_remove(struct id *idp, int id)

	removes the id from the idp name space.

void id2ptr_init(struct id *idp, int min_wrap)

	Initializes the idp name space.  The min_wrap value
	determines when to start reusing id values.

I think what I have done is useful and useable.  If/when I do 
this again I would separate growing the tree from the id
allocation.  I think this would avoid needing to keep 
the free list of preallocated memory.

Jim Houston - Concurrent Computer Corp.

             reply	other threads:[~2002-12-09 15:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-09 15:24 Jim Houston [this message]
2002-12-09 22:35 ` [PATCH 3/3] High-res-timers part 3 (posix to hrposix) take 20 William Lee Irwin III
2002-12-10  1:55   ` Jim Houston
2002-12-10  2:11     ` William Lee Irwin III
2002-12-10 16:41       ` Jim Houston
  -- strict thread matches above, loose matches on Subject: below --
2002-10-25 20:01 [PATCH 2/3] High-res-timers part 2 (x86 platform code) take 7 george anzinger
2002-12-08  7:48 ` [PATCH 3/3] High-res-timers part 3 (posix to hrposix) take 20 george anzinger
2002-12-08 23:34   ` Andrew Morton
2002-12-09  7:38     ` george anzinger
2002-12-09  8:04       ` Andrew Morton
2002-12-10  8:30         ` george anzinger
2002-12-10  9:24           ` Andrew Morton
2002-12-10  9:51             ` William Lee Irwin III
2002-12-10 23:39             ` george anzinger
2002-12-10 15:14           ` Joe Korty
2002-12-10 22:57             ` george anzinger
2002-12-09 12:34       ` george anzinger
2002-12-09 19:40       ` 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=3DF4B5C1.D36D4CCF@attbi.com \
    --to=jim.houston@attbi.com \
    --cc=akpm@digeo.com \
    --cc=george@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    /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.