Date: Sun, 12 Jul 1998 16:54:01 +0200 From: Stefan Eggers <seggers@semyam.dinoco.de> To: freebsd-hackers@FreeBSD.ORG Cc: zhihuizhang <bf20761@binghamton.edu>, seggers@semyam.dinoco.de Subject: Re: Question about shadow object collapse Message-ID: <199807121454.QAA13277@semyam.dinoco.de> In-Reply-To: Your message of "Sat, 11 Jul 1998 11:23:06 EDT." <Pine.SOL.L3.93.980711112150.758C-100000@sparky8>
next in thread | previous in thread | raw e-mail | index | archive | help
> the following comments found in the routine vm_object_collapse() (see > source file vm/vm_object.c): > > (1) Pages that have been paged out will be overwirteen by any of the > parent's pages that shadow them. (why so and how to know if a page has > been paged out?) (The following is just based on what I know by now and a little bit of thinking about how to answer the questions based on the article and the FreeBSD code. It might be wrong of course. As always with soft- ware it is w/o guarantees of any kind. ;->) First terminology as I understand it: The parent here is the object belonging to a process which shares some memory with another process. It's named shadow object in the paper. The backing object is the one containing the original pages before COW operations. The shadow objects point to this object. The while loop loops over backing objects's memq which only has the resident pages on it. Non-resident pages get handled by the call to swap_pager_copy shortly after the while loop for both objects being swap objects as it is the case for shared memory. For other object types the copying of the object->un_pager should take care of it. To the former I think the answer is that the backing objects page is discarded if we have our own copy. That's what the codes does as I understand it. We might get this situation due to COW. There are three cases handled by the two if/else near the comment: 1) The backing object's page falls outside the range we contain the pages for. For example a shared memory region where we removed our own mappings for part of it. We don't care about the backing objects's pages outside our territory and just drop them. 2) We either have a page resident in memory or somewhere in swap for a page in the backing object. Then we have our own copy of this page for some reason. No need to copy, then. 3) None of the above. We rely on the backing object's page and have to move it to ourself. Non-resident pages of the backing object swap_object_copy takes care of. I must admit the comments in the code are not that useful. Maybe we could replace them by something easier to understand. If you think what I wrote is OK it might be the basis for improved comments in that area of code. It took a longer time to get these answers and I don't think everybody should get penalized that way for trying to understand the VM subsystem without need. > (2) If the page falls outside the parent, dispose of it. (why so?) See above. Stefan. -- Stefan Eggers Lu4 yao2 zhi1 ma3 li4, Max-Slevogt-Str. 1 ri4 jiu3 jian4 ren2 xin1. 51109 Koeln Federal Republic of Germany To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807121454.QAA13277>