Re: MAP_NR

From: Linus Torvalds (torvalds@transmeta.com)
Date: Mon Oct 23 2000 - 12:40:57 EST


In article <Pine.Linu.4.10.10010200555140.4063-100000@mikeg.weiden.de>,
Mike Galbraith <mikeg@wen-online.de> wrote:
>On Thu, 19 Oct 2000 mdaljeet@in.ibm.com wrote:
>
>> can anyone tell the subsitute for MAP_NR in version 2.4?
>> or is MAP_NR still there?
>
>Hi,
>
>MAP_NR() became virt_to_page() as of test6-pre8.

Not quite.

The expression "(mem_map + MAP_NR(x))" has become "virt_to_page(x)".
There is nothing that is exactly the same as MAP_NR(), because the
concept doesn't really exist any more (there are now architectures out
there that have multiple page maps, so a single number is not sufficient
to describe the page).

Now, in 99% of all cases, this is how MAP_NR() was used, and most of the
time it's a simple 1:1 translation. In some cases there was one level of
indirection, something like

        int i;

        for (i = MAP_NR(x) ; i < MAP_NR(y); i++) {
                ...
                ... i + mem_map ...
                ...
        }

and in those cases it needs to be slightly rewritten to use "struct
page" pointers instead, ie something like

        struct page *page, *end;

        page = virt_to_page(x);
        end = virt_to_page(y);
        do {
                ..
        } while (++page < end);

rather than just a simple expression replacement.

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



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:21 EST