Re: [patch] swap-speedup-2.4.3-B3

From: Linus Torvalds (torvalds@transmeta.com)
Date: Tue Apr 24 2001 - 11:38:08 EST


On Tue, 24 Apr 2001, Ingo Molnar wrote:
>
> the latest swap-speedup patch can be found at:

Please don't add more of those horrible "wait" arguments.

Make two different versions of a function instead. It's going to clean up
and simplify the code, and there really isn't any reason to do what you're
doing.

You should split up the logic differently: if you want to wait for the
page, then DO so:

        page = lookup_swap_cache(..);
        if (page) {
                wait_for_swap_cache:valid(page);
                .. use page ..
        }

Note how much more readable and UNDERSTANDABLE the above is, compared to

        page = lookup_swap_cache(..., 1);
        if (page) {
                ...

and note also how splitting up the waiting will

 - simplify the swap cache lookup function, making it faster for people
   who do _NOT_ want to wait.

 - make it easier to statically check the correctness of programs by just
   eye-balling them ("Hey, he's calling 'wait' with the spinlock held").

 - more easily moving the wait around, allowing for more concurrency.

Basically, I don't want to mix synchronous and asynchronous
interfaces. Everything should be asynchronous by default, and waiting
should be explicit.

                Linus

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



This archive was generated by hypermail 2b29 : Mon Apr 30 2001 - 21:00:12 EST