Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)

From: Florian Mickler
Date: Thu Jun 03 2010 - 10:31:08 EST


On Thu, 3 Jun 2010 06:24:49 -0700
mark gross <640e9920@xxxxxxxxx> wrote:

> On Thu, Jun 03, 2010 at 12:10:03AM -0700, Arve Hjønnevåg wrote:

> ok I'm not getting it.
> is this a fancy com-sci algorithm I should know about?
>
> --mgross

I think you are at an advantage if you have studied fancy com-sci for
this? Here is an example:

say you have 5 constraints:
qos1 with a value of 10
qos2 with 5
qos3 with 10
qos4 with 11

Now, you hash that list by the qos-values:

11 ---- 10 ----- 5
| | |
qos4 qos3 qos2
|
qos1


To compute the maximum you just walk the "----" list.

To reduce qos4 from 11 to 5 you remove it from its "|" list and
prepend it to the corresponding "|" list. (4 Pointer adjustments +
searching the "-----" list for the right place to insert.

result:

10 ---- 5
| |
qos3 qos4
| |
qos1 qos2

Cheers,
Flo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/