[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: Can multiple vm_pages refer to a same swap device page?
From:       Konstantin Belousov <kostikbel () gmail ! com>
Date:       2019-10-03 8:33:11
Message-ID: 20191003083311.GH44691 () kib ! kiev ! ua
[Download RAW message or body]

On Wed, Oct 02, 2019 at 04:31:41PM -0400, Yoshihiro Ota wrote:
> Hi forks,
> 
> Given a process can allocate lot of memory even cosuming swap space, then fork a \
> child process, and both parent and child processes stay live while doing differen \
> things, I expect a system needs to track how many processes are refering to same \
> swap pages. 
No, it does not.

> How does FreeBSD keep track of multiple processes refering to same swap pages?
> Is it by multiple vm_page objects pointing to same swap device pages with daddr_t?
> 
> I've been looking around swap_pager.h, vm_page, vm_object, struct swblk, and struct \
> swdevt but I don't find reference count for swap device pages. 
> Am I missing something?
Yes, the mechanism for CoW sharing the same read-only page is called
shadowing and it is a form of the content inheritance, where we insert a
new default (later swap) object on top of existing object on forking.

The sentence above perhaps sounds too cryptic, I recommend you to look
at the 'Design and Implementation' book by McKusick and this old article
by Dillon
https://www.freebsd.org/doc/en_US.ISO8859-1/articles/vm-design/index.html
The part about vm objects is still relevant and should answer your question.
_______________________________________________
freebsd-hackers@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic