How many page table the linux kernel maintains?
Clash Royale CLAN TAG#URR8PPP
the kernel maintains a data structure, called a page table, that contains a mapping of
a processes' virtual page addresses to real page addresses in memory.
I read a book with the sentence above, I don't know why it's a processes'? So the kernel
has a single page table which contains mappings for many processes, i.e. kernel didn't store those page tables for all processes separately, but in a single page table?
The book is How Linux Works by Brian Ward, 2nd, page 182, line 4.
It seems like the book has some grammar errors:
table, that should be table that: no error. (thanks for the comment!)
a mapping of a processes' should be a mapping of a process's
linux linux-kernel
add a comment |
the kernel maintains a data structure, called a page table, that contains a mapping of
a processes' virtual page addresses to real page addresses in memory.
I read a book with the sentence above, I don't know why it's a processes'? So the kernel
has a single page table which contains mappings for many processes, i.e. kernel didn't store those page tables for all processes separately, but in a single page table?
The book is How Linux Works by Brian Ward, 2nd, page 182, line 4.
It seems like the book has some grammar errors:
table, that should be table that: no error. (thanks for the comment!)
a mapping of a processes' should be a mapping of a process's
linux linux-kernel
2
“... a data structure, called a page table, that ...” is correct: “that” refers to “a data structure”.
– Stephen Kitt
Dec 11 at 20:57
@StephenKitt: That makes sense, thank you!
– ptr_user7813604
Dec 11 at 21:11
add a comment |
the kernel maintains a data structure, called a page table, that contains a mapping of
a processes' virtual page addresses to real page addresses in memory.
I read a book with the sentence above, I don't know why it's a processes'? So the kernel
has a single page table which contains mappings for many processes, i.e. kernel didn't store those page tables for all processes separately, but in a single page table?
The book is How Linux Works by Brian Ward, 2nd, page 182, line 4.
It seems like the book has some grammar errors:
table, that should be table that: no error. (thanks for the comment!)
a mapping of a processes' should be a mapping of a process's
linux linux-kernel
the kernel maintains a data structure, called a page table, that contains a mapping of
a processes' virtual page addresses to real page addresses in memory.
I read a book with the sentence above, I don't know why it's a processes'? So the kernel
has a single page table which contains mappings for many processes, i.e. kernel didn't store those page tables for all processes separately, but in a single page table?
The book is How Linux Works by Brian Ward, 2nd, page 182, line 4.
It seems like the book has some grammar errors:
table, that should be table that: no error. (thanks for the comment!)
a mapping of a processes' should be a mapping of a process's
linux linux-kernel
linux linux-kernel
edited Dec 11 at 21:12
asked Dec 11 at 19:39
ptr_user7813604
1186
1186
2
“... a data structure, called a page table, that ...” is correct: “that” refers to “a data structure”.
– Stephen Kitt
Dec 11 at 20:57
@StephenKitt: That makes sense, thank you!
– ptr_user7813604
Dec 11 at 21:11
add a comment |
2
“... a data structure, called a page table, that ...” is correct: “that” refers to “a data structure”.
– Stephen Kitt
Dec 11 at 20:57
@StephenKitt: That makes sense, thank you!
– ptr_user7813604
Dec 11 at 21:11
2
2
“... a data structure, called a page table, that ...” is correct: “that” refers to “a data structure”.
– Stephen Kitt
Dec 11 at 20:57
“... a data structure, called a page table, that ...” is correct: “that” refers to “a data structure”.
– Stephen Kitt
Dec 11 at 20:57
@StephenKitt: That makes sense, thank you!
– ptr_user7813604
Dec 11 at 21:11
@StephenKitt: That makes sense, thank you!
– ptr_user7813604
Dec 11 at 21:11
add a comment |
1 Answer
1
active
oldest
votes
It's a bit more complicated than that.
First off, there is only one true page table for any given processor core at a time. This is because it's the hardware that does the actual mapping of virtual addresses to physical addresses (more specifically, the MMU), and the kernel only ever gets involved when the contents of the page table have to change.
In addition, the kernel stores it's own information about the state of the virtual memory mappings for each execution context (process, thread, or kernel thread) separately. These are stored independently of each other and separate from the page tables used by the hardware for address mapping. Whenever the execution context changes (for example, a process makes a system call or an interrupt handler gets woken up to service an interrupt), part of the process of switching the execution context involves flushing the old entries from the hardware page table, and then loading it with the new entries. Depending on the two contexts, this may involve only repopulating a very small number of entries (for example, switching threads of the same userspace process), or it might require reloading the entire table (for example, switching from a user process to an interrupt handler).
I don't quite understand your Independent of that, ... and from the hardware page table, could you elaborate more? (especially the both from each other.)
– ptr_user7813604
Dec 11 at 20:15
I've updated the answer to hopefully clarify things better. Sorry that it was a bit confusing.
– Austin Hemmelgarn
Dec 11 at 20:22
1
In the last sentence, reloading the entire table used to be rare (or at least, it could have been made rare, since the kernel mapping didn’t change), and switching from a user process to the kernel didn’t involve touching the page table; all that changed with KAISER/KPTI.
– Stephen Kitt
Dec 11 at 20:56
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f487435%2fhow-many-page-table-the-linux-kernel-maintains%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It's a bit more complicated than that.
First off, there is only one true page table for any given processor core at a time. This is because it's the hardware that does the actual mapping of virtual addresses to physical addresses (more specifically, the MMU), and the kernel only ever gets involved when the contents of the page table have to change.
In addition, the kernel stores it's own information about the state of the virtual memory mappings for each execution context (process, thread, or kernel thread) separately. These are stored independently of each other and separate from the page tables used by the hardware for address mapping. Whenever the execution context changes (for example, a process makes a system call or an interrupt handler gets woken up to service an interrupt), part of the process of switching the execution context involves flushing the old entries from the hardware page table, and then loading it with the new entries. Depending on the two contexts, this may involve only repopulating a very small number of entries (for example, switching threads of the same userspace process), or it might require reloading the entire table (for example, switching from a user process to an interrupt handler).
I don't quite understand your Independent of that, ... and from the hardware page table, could you elaborate more? (especially the both from each other.)
– ptr_user7813604
Dec 11 at 20:15
I've updated the answer to hopefully clarify things better. Sorry that it was a bit confusing.
– Austin Hemmelgarn
Dec 11 at 20:22
1
In the last sentence, reloading the entire table used to be rare (or at least, it could have been made rare, since the kernel mapping didn’t change), and switching from a user process to the kernel didn’t involve touching the page table; all that changed with KAISER/KPTI.
– Stephen Kitt
Dec 11 at 20:56
add a comment |
It's a bit more complicated than that.
First off, there is only one true page table for any given processor core at a time. This is because it's the hardware that does the actual mapping of virtual addresses to physical addresses (more specifically, the MMU), and the kernel only ever gets involved when the contents of the page table have to change.
In addition, the kernel stores it's own information about the state of the virtual memory mappings for each execution context (process, thread, or kernel thread) separately. These are stored independently of each other and separate from the page tables used by the hardware for address mapping. Whenever the execution context changes (for example, a process makes a system call or an interrupt handler gets woken up to service an interrupt), part of the process of switching the execution context involves flushing the old entries from the hardware page table, and then loading it with the new entries. Depending on the two contexts, this may involve only repopulating a very small number of entries (for example, switching threads of the same userspace process), or it might require reloading the entire table (for example, switching from a user process to an interrupt handler).
I don't quite understand your Independent of that, ... and from the hardware page table, could you elaborate more? (especially the both from each other.)
– ptr_user7813604
Dec 11 at 20:15
I've updated the answer to hopefully clarify things better. Sorry that it was a bit confusing.
– Austin Hemmelgarn
Dec 11 at 20:22
1
In the last sentence, reloading the entire table used to be rare (or at least, it could have been made rare, since the kernel mapping didn’t change), and switching from a user process to the kernel didn’t involve touching the page table; all that changed with KAISER/KPTI.
– Stephen Kitt
Dec 11 at 20:56
add a comment |
It's a bit more complicated than that.
First off, there is only one true page table for any given processor core at a time. This is because it's the hardware that does the actual mapping of virtual addresses to physical addresses (more specifically, the MMU), and the kernel only ever gets involved when the contents of the page table have to change.
In addition, the kernel stores it's own information about the state of the virtual memory mappings for each execution context (process, thread, or kernel thread) separately. These are stored independently of each other and separate from the page tables used by the hardware for address mapping. Whenever the execution context changes (for example, a process makes a system call or an interrupt handler gets woken up to service an interrupt), part of the process of switching the execution context involves flushing the old entries from the hardware page table, and then loading it with the new entries. Depending on the two contexts, this may involve only repopulating a very small number of entries (for example, switching threads of the same userspace process), or it might require reloading the entire table (for example, switching from a user process to an interrupt handler).
It's a bit more complicated than that.
First off, there is only one true page table for any given processor core at a time. This is because it's the hardware that does the actual mapping of virtual addresses to physical addresses (more specifically, the MMU), and the kernel only ever gets involved when the contents of the page table have to change.
In addition, the kernel stores it's own information about the state of the virtual memory mappings for each execution context (process, thread, or kernel thread) separately. These are stored independently of each other and separate from the page tables used by the hardware for address mapping. Whenever the execution context changes (for example, a process makes a system call or an interrupt handler gets woken up to service an interrupt), part of the process of switching the execution context involves flushing the old entries from the hardware page table, and then loading it with the new entries. Depending on the two contexts, this may involve only repopulating a very small number of entries (for example, switching threads of the same userspace process), or it might require reloading the entire table (for example, switching from a user process to an interrupt handler).
edited Dec 11 at 20:19
answered Dec 11 at 20:04
Austin Hemmelgarn
5,96111016
5,96111016
I don't quite understand your Independent of that, ... and from the hardware page table, could you elaborate more? (especially the both from each other.)
– ptr_user7813604
Dec 11 at 20:15
I've updated the answer to hopefully clarify things better. Sorry that it was a bit confusing.
– Austin Hemmelgarn
Dec 11 at 20:22
1
In the last sentence, reloading the entire table used to be rare (or at least, it could have been made rare, since the kernel mapping didn’t change), and switching from a user process to the kernel didn’t involve touching the page table; all that changed with KAISER/KPTI.
– Stephen Kitt
Dec 11 at 20:56
add a comment |
I don't quite understand your Independent of that, ... and from the hardware page table, could you elaborate more? (especially the both from each other.)
– ptr_user7813604
Dec 11 at 20:15
I've updated the answer to hopefully clarify things better. Sorry that it was a bit confusing.
– Austin Hemmelgarn
Dec 11 at 20:22
1
In the last sentence, reloading the entire table used to be rare (or at least, it could have been made rare, since the kernel mapping didn’t change), and switching from a user process to the kernel didn’t involve touching the page table; all that changed with KAISER/KPTI.
– Stephen Kitt
Dec 11 at 20:56
I don't quite understand your Independent of that, ... and from the hardware page table, could you elaborate more? (especially the both from each other.)
– ptr_user7813604
Dec 11 at 20:15
I don't quite understand your Independent of that, ... and from the hardware page table, could you elaborate more? (especially the both from each other.)
– ptr_user7813604
Dec 11 at 20:15
I've updated the answer to hopefully clarify things better. Sorry that it was a bit confusing.
– Austin Hemmelgarn
Dec 11 at 20:22
I've updated the answer to hopefully clarify things better. Sorry that it was a bit confusing.
– Austin Hemmelgarn
Dec 11 at 20:22
1
1
In the last sentence, reloading the entire table used to be rare (or at least, it could have been made rare, since the kernel mapping didn’t change), and switching from a user process to the kernel didn’t involve touching the page table; all that changed with KAISER/KPTI.
– Stephen Kitt
Dec 11 at 20:56
In the last sentence, reloading the entire table used to be rare (or at least, it could have been made rare, since the kernel mapping didn’t change), and switching from a user process to the kernel didn’t involve touching the page table; all that changed with KAISER/KPTI.
– Stephen Kitt
Dec 11 at 20:56
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f487435%2fhow-many-page-table-the-linux-kernel-maintains%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
“... a data structure, called a page table, that ...” is correct: “that” refers to “a data structure”.
– Stephen Kitt
Dec 11 at 20:57
@StephenKitt: That makes sense, thank you!
– ptr_user7813604
Dec 11 at 21:11