mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Werner Almesberger <wa@almesberger.net>
Cc: Rajesh Venkatasubramanian <vrajesh@umich.edu>,
	linux-kernel@vger.kernel.org
Subject: Re: prio_tree generalization
Date: Mon, 5 Jul 2004 04:07:40 +0200	[thread overview]
Message-ID: <20040705020740.GA3246@dualathlon.random> (raw)
In-Reply-To: <20040704222438.A11865@almesberger.net>

On Sun, Jul 04, 2004 at 10:24:38PM -0300, Werner Almesberger wrote:
> Hi Rajesh,
> 
> I'm currently experimenting with the prio_tree code in an elevator
> ("IO scheduler"), and I'm thinking about a way to avoid code
> duplication.

that's a nice effort, I agree prio_tree.c is better suited for lib/ than
mm/ but the code already looks quite generic and well written.

>
> The most straightforward approach seems to be to put everything
> after prio_tree_init and before vma_prio_tree_add into a new file,
> and #include that file. (And prio_tree_init should be shared.)
> 
> #including a .c file normally isn't exactly considered an epitome
> of elegance, but in this case, there doesn't seem to be much of a
> choice.

why don't you move the shared code to lib/prio_tree.c instead of
duplicating it in every object?
prio_tree_insert/prio_tree_remove/prio_tree_replace needs to be
exported etc..

> There's another issue: in the elevator, entries overlap only
> rarely if at all, and it is sometimes useful to walk the tree in
> sort order. As far as I can tell, RPSTs can be walked just like
> RB trees if there are no overlaps on the path from the current to
> the respective adjacent node.
> 
> Unfortunately, "prio_tree_next" is already taken. It would be nice
> to follow the same naming scheme as RB trees, so perhaps
> prio_tree_next could become prio_tree_more, or such ?

I thought prio_tree_next was already the equivalent of rb_next for
prio-trees. The API is slightly different because you need an iterator
object, but I'm not sure how you want to change it to make it more
symmetric with rb_next.

  reply	other threads:[~2004-07-05  2:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-05  1:24 Werner Almesberger
2004-07-05  2:07 ` Andrea Arcangeli [this message]
2004-07-05  2:36   ` Werner Almesberger
2004-07-05  4:46 ` Andrew Morton
2004-07-05 11:05   ` Werner Almesberger

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=20040705020740.GA3246@dualathlon.random \
    --to=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vrajesh@umich.edu \
    --cc=wa@almesberger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®