4level page tables for Linux II
Hmmm...
pml4, pgd, pmd, pte (kernel names)
PML4E, PDPE, PDE, PTE (AMD hardware names)
It's kind of a mess, isn't it? It was bad enough with the "pmd" (page middle directory, ugh) being some random invention and everything being generally in conflict with real hardware naming. Now you've come up with a fourth name.
Notice that you've resorted to using a number. Why not do that for the others too? It would bring some order to this ever-growing collection of arbitrary names. Like this:
pd4, pd3, pd2, pd1
Quoted 4 lines · On 12 Oct 2004 23:36:40 -0400 Albert Cahalan <[email protected]> wrote:
Hmmm...
pml4, pgd, pmd, pte (kernel names)
PML4E, PDPE, PDE, PTE (AMD hardware names)
No actually a PML4E is a PML4 _E_ntry in the AMD/Intel docs. PML4 is the official name for the fourth level page.
Quoted 7 lines
It's kind of a mess, isn't it? It was bad enough with the "pmd" (page middle directory, ugh) being some random invention and everything being generally in conflict with real hardware naming. Now you've come up with a fourth name.
Notice that you've resorted to using a number.
I just followed AMD.
Quoted 3 lines
Why not do that for the others too? It would bring some order to this ever-growing collection of arbitrary names. Like this:
I don't think it makes sense to break code unnecessarily.
And when you cannot remember the few names for the level you better shouldn't touch VM at all.
-Andi
Quoted 21 lines · Andi Kleen
Quoted 4 lines · On 12 Oct 2004 23:36:40 -0400 Albert Cahalan <[email protected]> wrote:
Hmmm...
pml4, pgd, pmd, pte (kernel names)
PML4E, PDPE, PDE, PTE (AMD hardware names)No actually a PML4E is a PML4
_E_ntryin the AMD/Intel docs. PML4 is the official name for the fourth level page.Quoted 7 lines
It's kind of a mess, isn't it? It was bad enough with the "pmd" (page middle directory, ugh) being some random invention and everything being generally in conflict with real hardware naming. Now you've come up with a fourth name.
Notice that you've resorted to using a number.
I just followed AMD.
Quoted 8 lines
Quoted 3 lines
Why not do that for the others too? It would bring some order to this ever-growing collection of arbitrary names. Like this:
I don't think it makes sense to break code unnecessarily.
And when you cannot remember the few names for the level you better shouldn't touch VM at all.
One of the reasons that Linux is so hackable is that crummy names get changed. Here too, the old names are bad.
An old example: we use copy_from_user now, not copy_fromfs. Don't you agree that this is an improvement? It broke code unnecessarily, but Linus did it anyway. Linux would be a lot less readable if it had screwy names everywhere.
Perhaps you shouldn't touch kernel code if you can't remember that copy_fromfs is unrelated to fs code. Still, why make things difficult? The less effort you waste remembering stupid names, the more you can spare for writing great code.
Quoted 2 lines · Andi Kleen
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.)
Signature · 1 line
Matthias Urlichs
Quoted 5 lines · Matthias Urlichs
Quoted 2 lines · Andi Kleen
And when you cannot remember the few names for the level you better shouldn't touch VM at all.
Quoted 8 lines
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
Quoted 7 lines · Andrew Grover
On Thu, 14 Oct 2004 18:57:24 +0200, Matthias Urlichs
Quoted 6 lines
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..?
Quoted 8 lines
Quoted 2 lines
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
Signature · 4 lines
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
Hi,
Jörn Engel:
Quoted 5 lines
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.
Signature · 1 line
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | [email protected]Quoted 2 lines · Matthias Urlichs
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.
Quoted 2 lines
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. ;)
Quoted 3 lines
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
Signature · 4 lines
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..."
Quoted 5 lines · Jörn Engel
Quoted 3 lines
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