* Re: 4level page tables for Linux II
2004-10-12 19:03 ` Andi Kleen
@ 2004-10-12 19:08 ` Andi Kleen
0 siblings, 0 replies; 10+ messages in thread
From: Andi Kleen @ 2004-10-12 19:08 UTC (permalink / raw)
To: Andi Kleen; +Cc: Dave Hansen, Linux Kernel Mailing List, akpm
On Tue, Oct 12, 2004 at 09:03:46PM +0200, Andi Kleen wrote:
> On Tue, Oct 12, 2004 at 11:48:22AM -0700, Dave Hansen wrote:
> > @@ -110,13 +115,18 @@ int install_file_pte(struct mm_struct *m
> > unsigned long addr, unsigned long pgoff, pgprot_t prot)
> > {
> > ...
> > + pml4 = pml4_offset(mm, addr);
> > +
> > + spin_lock(&mm->page_table_lock);
> > + pgd = pgd_alloc(mm, pml4, addr);
> > + if (!pgd)
> > + goto err_unlock;
> >
> > Locking isn't needed for access to the pml4? This is a wee bit
> > different from pgd's and I didn't see any documentation about it
> > anywhere. Could be confusing.
>
> No, the lock is still needed. Thanks for catching this, that was indeed
> wrong.
Actually on second though - the code was actually ok. The reason is
that the highest page table level never goes away while the process
exists, and holding a pointer into it is always valid.
Only referencing it needs a lock, but pml4_offset doesn't reference
anything yet.
The same used to hold for pgds, but the 4level page tables change that.
However there was at least one bug in the patchkit in this area
which I now fixed.
-Andi
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 4level page tables for Linux II
@ 2004-10-13 3:36 Albert Cahalan
2004-10-13 7:22 ` Andi Kleen
0 siblings, 1 reply; 10+ messages in thread
From: Albert Cahalan @ 2004-10-13 3:36 UTC (permalink / raw)
To: linux-kernel mailing list; +Cc: ak
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 4level page tables for Linux II
2004-10-13 3:36 4level page tables for Linux II Albert Cahalan
@ 2004-10-13 7:22 ` Andi Kleen
2004-10-13 21:42 ` Albert Cahalan
2004-10-14 16:57 ` Matthias Urlichs
0 siblings, 2 replies; 10+ messages in thread
From: Andi Kleen @ 2004-10-13 7:22 UTC (permalink / raw)
To: Albert Cahalan; +Cc: linux-kernel
On 12 Oct 2004 23:36:40 -0400
Albert Cahalan <albert@users.sf.net> 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.
> 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.
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 4level page tables for Linux II
2004-10-13 7:22 ` Andi Kleen
@ 2004-10-13 21:42 ` Albert Cahalan
2004-10-14 16:57 ` Matthias Urlichs
1 sibling, 0 replies; 10+ messages in thread
From: Albert Cahalan @ 2004-10-13 21:42 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel mailing list
On Wed, 2004-10-13 at 03:22, Andi Kleen wrote:
> On 12 Oct 2004 23:36:40 -0400
> Albert Cahalan <albert@users.sf.net> 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.
>
> > 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.
>
> > 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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 4level page tables for Linux II
2004-10-13 7:22 ` Andi Kleen
2004-10-13 21:42 ` Albert Cahalan
@ 2004-10-14 16:57 ` Matthias Urlichs
2004-10-15 1:55 ` Andrew Grover
1 sibling, 1 reply; 10+ messages in thread
From: Matthias Urlichs @ 2004-10-14 16:57 UTC (permalink / raw)
To: linux-kernel
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 4level page tables for Linux II
2004-10-14 16:57 ` Matthias Urlichs
@ 2004-10-15 1:55 ` Andrew Grover
2004-10-15 13:28 ` Jörn Engel
0 siblings, 1 reply; 10+ messages in thread
From: Andrew Grover @ 2004-10-15 1:55 UTC (permalink / raw)
To: Matthias Urlichs; +Cc: linux-kernel
On Thu, 14 Oct 2004 18:57:24 +0200, Matthias Urlichs
<smurf@smurf.noris.de> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 4level page tables for Linux II
2004-10-15 1:55 ` Andrew Grover
@ 2004-10-15 13:28 ` Jörn Engel
2004-10-15 13:55 ` Matthias Urlichs
0 siblings, 1 reply; 10+ messages in thread
From: Jörn Engel @ 2004-10-15 13:28 UTC (permalink / raw)
To: Andrew Grover; +Cc: Matthias Urlichs, linux-kernel
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 4level page tables for Linux II
2004-10-15 13:28 ` Jörn Engel
@ 2004-10-15 13:55 ` Matthias Urlichs
2004-10-15 23:39 ` Jörn Engel
0 siblings, 1 reply; 10+ messages in thread
From: Matthias Urlichs @ 2004-10-15 13:55 UTC (permalink / raw)
To: Jörn Engel; +Cc: Andrew Grover, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 660 bytes --]
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 | smurf@smurf.noris.de
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 4level page tables for Linux II
2004-10-15 13:55 ` Matthias Urlichs
@ 2004-10-15 23:39 ` Jörn Engel
2004-10-17 5:54 ` Ingo Molnar
0 siblings, 1 reply; 10+ messages in thread
From: Jörn Engel @ 2004-10-15 23:39 UTC (permalink / raw)
To: Matthias Urlichs; +Cc: Andrew Grover, linux-kernel
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..."
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 4level page tables for Linux II
2004-10-15 23:39 ` Jörn Engel
@ 2004-10-17 5:54 ` Ingo Molnar
0 siblings, 0 replies; 10+ messages in thread
From: Ingo Molnar @ 2004-10-17 5:54 UTC (permalink / raw)
To: Jörn Engel; +Cc: Matthias Urlichs, Andrew Grover, linux-kernel, Andi Kleen
* Jörn Engel <joern@wohnheim.fh-wedel.de> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-10-17 5:53 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-13 3:36 4level page tables for Linux II Albert Cahalan
2004-10-13 7:22 ` Andi Kleen
2004-10-13 21:42 ` Albert Cahalan
2004-10-14 16:57 ` Matthias Urlichs
2004-10-15 1:55 ` Andrew Grover
2004-10-15 13:28 ` Jörn Engel
2004-10-15 13:55 ` Matthias Urlichs
2004-10-15 23:39 ` Jörn Engel
2004-10-17 5:54 ` Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2004-10-12 13:59 4level page tables for Linux Andi Kleen
2004-10-12 18:48 ` Dave Hansen
2004-10-12 19:03 ` Andi Kleen
2004-10-12 19:08 ` 4level page tables for Linux II Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox