a question on mapping from PTE to swap entry
valdis.kletnieks at vt.edu
valdis.kletnieks at vt.edu
Thu Nov 15 12:59:52 EST 2018
On Thu, 15 Nov 2018 23:53:56 +0800, "Larry" said:
> I'm curious when multiple process has the same PTE which points to the samepage,
> how can kernel differenciate which page from swap space should be swappedin?
The PTE tells where in /dev/swap to find the page. If it's a shared page, the
references all point at the same place, so "process 1's PAGE_A info" is the
same as "process 2's PAGE_A" info. They may have different addresses in the
two processes, but they're both referencing the same swap page.
> Process 2 get scheduled, PAGE_A was from Process 1, so it should be swapped out
Why? In general, there's no need to do so - and if it's shared, it's probably a hot page
so it won't be chosen for swapout.
(Remember - the kernel doesn't do swapin/swapout decisions in schedule(), it
only takes action once Process 2 starts running and references a page that requires
something be done.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20181115/dd74e597/attachment.sig>
More information about the Kernelnewbies
mailing list