linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@transmeta.com>
To: "David S. Miller" <davem@redhat.com>
Cc: Rik van Riel <riel@conectiva.com.br>,
	linux-mm@kvack.org, "Stephen C. Tweedie" <sct@redhat.com>,
	Matthew Dillon <dillon@apollo.backplane.com>
Subject: Re: [RFC] 2-pointer PTE chaining idea
Date: Thu, 18 Jan 2001 23:17:35 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.10.10101182307340.9418-100000@penguin.transmeta.com> (raw)
In-Reply-To: <14951.58719.533776.944814@pizda.ninka.net>


On Thu, 18 Jan 2001, David S. Miller wrote:

> 
> Rik van Riel writes:
>  > In order to find the vma and the mm_struct each pte belongs to,
>  > we can use the ->mapping and ->index fields in the page_struct
>  > of the page table, with the ->mapping pointing to the mm_struct
>  > and the ->index containing the offset within the mm_struct
> 
> Anonymous pages have no page->mapping, how can this work?

Note the "in the page struct of the page table".
                                    ^^^^^^^^^^

What Rik is saying is that if your page tables themselves are full pages
(which is not true everywhere, but hey, close enough), you can use the
"struct page *" of the _page_table_ page to save off the "struct
mm_struct" pointer, along with the base in the mm_struct. You can then lok
up the vma the normal way (get the mm->page_table_lock, and search for it,
you know where the page table entry is in the page table, and you know
where the page table itself is virtually).

It doesn't help us, though. 2 or 3 pointers doesn't make any difference on
x86, at least: the 3-pointer-scheme had a "next, prev, mm" pointer triple,
and there is an _implied_ pointer pointing to the page table entry itself,
that Rik probably forgot about.

The only sane way I can think of to do the "implied pointer" is to do an
order-2 allocation when you allocate a page directory: you get 16kB of
memory, and you use the low 4kB for the hardware page table stuff, with
the upper 3kB for the pointers associated with the page table entries. You
do this for two reasons: 
 - still only one allocation
 - this way you can get from the pointers to the page table entry (and
   the other way around) by arithmetic rather than having to have a
   pointer to the page table entry.

But this also means that If you need 2 pointers, you might as well use 3
extra words anyway, because otherwise you'd just have an unused 32-bit
word for every page table entry anyway.

Whatever. Maybe it can be done other ways. The fact that the way I thought
to implement it was with an order-2 allocation to do this efficiently is
what really killed it for me. Maybe Rik has other ideas. I don't think
order-2 allocations are acceptable.

		Linus


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

  reply	other threads:[~2001-01-19  7:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-19  5:08 Rik van Riel
2001-01-19  6:57 ` David S. Miller
2001-01-19  7:17   ` Linus Torvalds [this message]
2001-01-19  7:55     ` Rik van Riel
2001-01-20  5:22       ` Linus Torvalds
2001-01-20  5:31         ` David S. Miller
2001-01-20  7:05           ` Rik van Riel
2001-01-19 11:49     ` Ingo Molnar
2001-01-20  6:58     ` Rik van Riel
2001-01-19 11:37 ` Ingo Molnar

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=Pine.LNX.4.10.10101182307340.9418-100000@penguin.transmeta.com \
    --to=torvalds@transmeta.com \
    --cc=davem@redhat.com \
    --cc=dillon@apollo.backplane.com \
    --cc=linux-mm@kvack.org \
    --cc=riel@conectiva.com.br \
    --cc=sct@redhat.com \
    /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