2004-10-14 16:57:41

by Matthias Urlichs

[permalink] [raw]
Subject: Re: 4level page tables for Linux II

Hi, Andi Kleen wrote:

> And when you cannot remember the few names for the level you
> better shouldn't touch VM at all.

Disagree. Rather strongly in fact.

It's probably OK if you already know the stuff and have been hacking
Linux' mm for years already, but if you try to learn how things work by
actually looking at the code..?

Just number them. Let pd1 point to pages, pd2 to pd1 entries, and so on.
(Level zero is the actual pages.)

--
Matthias Urlichs


2004-10-15 01:55:23

by Andrew Grover

[permalink] [raw]
Subject: Re: 4level page tables for Linux II

On Thu, 14 Oct 2004 18:57:24 +0200, Matthias Urlichs
<[email protected]> wrote:
> Hi, Andi Kleen wrote:
>
> > And when you cannot remember the few names for the level you
> > better shouldn't touch VM at all.
>
> Disagree. Rather strongly in fact.
>
> It's probably OK if you already know the stuff and have been hacking
> Linux' mm for years already, but if you try to learn how things work by
> actually looking at the code..?
>
> Just number them. Let pd1 point to pages, pd2 to pd1 entries, and so on.
> (Level zero is the actual pages.)

I happen to agree, but surely this can be addressed at our leisure,
after pml4 is in.

Maybe a good task for the kernel janitors, if we all agree more
sensible names are desirable.

Regards -- Andy

2004-10-15 13:32:11

by Jörn Engel

[permalink] [raw]
Subject: Re: 4level page tables for Linux II

On Thu, 14 October 2004 18:55:20 -0700, Andrew Grover wrote:
> On Thu, 14 Oct 2004 18:57:24 +0200, Matthias Urlichs
> > Disagree. Rather strongly in fact.
> >
> > It's probably OK if you already know the stuff and have been hacking
> > Linux' mm for years already, but if you try to learn how things work by
> > actually looking at the code..?
> >
> > Just number them. Let pd1 point to pages, pd2 to pd1 entries, and so on.
> > (Level zero is the actual pages.)
>
> I happen to agree, but surely this can be addressed at our leisure,
> after pml4 is in.
>
> Maybe a good task for the kernel janitors, if we all agree more
> sensible names are desirable.

Please don't. Current names may be odd, but at least they are
sufficiently different from one another. 4 names that only differ in
a single number are an invitation for typos, thinkos and similar
confusion.

Whenever I notice a mess like that in any piece of software I change
it to make the difference bigger, not smaller. Have you ever been
slightly distracted, kept typing anyway and it compiled just fine,
creating a subtle bug? ;)

J?rn

--
When I am working on a problem I never think about beauty. I think
only how to solve the problem. But when I have finished, if the
solution is not beautiful, I know it is wrong.
-- R. Buckminster Fuller

2004-10-15 13:59:42

by Matthias Urlichs

[permalink] [raw]
Subject: Re: 4level page tables for Linux II

Hi,

J?rn Engel:
> Please don't. Current names may be odd, but at least they are
> sufficiently different from one another. 4 names that only differ in
> a single number are an invitation for typos, thinkos and similar
> confusion.
>
Right now, so are the existing names: you have to remember which is which.

Levels numbered 1..4 are much simpler: you only have to remember that
the actual pages are level zero.

The solution of your typo problem is typechecking in the compiler;
presumably it'll warn me if I try to store a pgd3 pointer in a pgd2
entry.

--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | [email protected]


Attachments:
(No filename) (641.00 B)
signature.asc (189.00 B)
Digital signature
Download all attachments

2004-10-15 23:39:31

by Jörn Engel

[permalink] [raw]
Subject: Re: 4level page tables for Linux II

On Fri, 15 October 2004 15:55:21 +0200, Matthias Urlichs wrote:
>
> Right now, so are the existing names: you have to remember which is which.

That appears to be the problem with any name. Still, my confusion
about which is read(2) and which is write(2) is rare.

> Levels numbered 1..4 are much simpler: you only have to remember that
> the actual pages are level zero.

if and goto is much simpler, compared to while, for, do..while, else,
and whatever slipped my mind right now. Maybe you should target the c
standard next. ;)

> The solution of your typo problem is typechecking in the compiler;
> presumably it'll warn me if I try to store a pgd3 pointer in a pgd2
> entry.

That should help somewhat, agreed. Patches?

J?rn

--
Public Domain - Free as in Beer
General Public - Free as in Speech
BSD License - Free as in Enterprise
Shared Source - Free as in "Work will make you..."

2004-10-17 05:53:24

by Ingo Molnar

[permalink] [raw]
Subject: Re: 4level page tables for Linux II


* J?rn Engel <[email protected]> wrote:

> > The solution of your typo problem is typechecking in the compiler;
> > presumably it'll warn me if I try to store a pgd3 pointer in a pgd2
> > entry.
>
> That should help somewhat, agreed. Patches?

Type-checking of pte/pmd/pgd has been part of the kernel for the past 7
years or so. Andi's patch implements it for pml4's too.

the pt1/pt2/pt3/pt4 distinction makes more sense stylistically, but the
current patch should be engineered for as minimal impact as possible.
Drastic changes to the MM namespace can be done later (if ever).

Ingo