[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200804161807.25582.ioe-lkml@rameria.de>
Date: Wed, 16 Apr 2008 18:07:24 +0200
From: Ingo Oeser <ioe-lkml@...eria.de>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Matthew Wilcox <matthew@....cx>, Andi Kleen <andi@...stfloor.org>,
Peter Zijlstra <peterz@...radead.org>,
Bart Van Assche <bart.vanassche@...il.com>,
Roland Dreier <rdreier@...co.com>, Ingo Molnar <mingo@...e.hu>,
Daniel Walker <dwalker@...sta.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Replace completions with semaphores
On Tuesday 15 April 2008, Linus Torvalds wrote:
> Would it make sense to use completions for countable events too? Yeah. In
> fact, we have some things that really would like to do counting, both in
> the sense of "wait for <n> events to all complete" _and_ in the sense of
> "allow up to <n> events to be outstanding". Both of which could be done as
> a counting function (just make "complete" increment the counter, and then
> make "wait for <n> events" initialize it to negative, while "allow <n>
> outstanding events" would be a positive counter, and make
> "wait_for_completion()" basically be a "decrement and wait until it
Hmm, why not introduce a provide_slots(),
wait_for_slot() and free_slot() API?
provide_slots() := initialize a resource with N available slots
wait_for_slot() := wait for a slot in countable resource to be free
free_slot() := make a slot available
That would:
- fit the use case nicely
- could be optimized for countable resources
with upper limits
- allow to measure slot utilization
- ...
- is not called semaphore :-)
And isn't this the same problem (called scheduling) as:
- keeping N cpus busy
- keeping N (disk) spindles busy
- keeping N nic transmit queues busy
- ...
???
But maybe I oversimplify here :-)
Best Regards
Ingo Oeser
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists