Date: Tue, 1 Jun 1999 20:06:04 -0700 (PDT) From: Matthew Dillon <dillon@apollo.backplane.com> To: Arun Sharma <adsharma@home.com> Cc: hackers@FreeBSD.ORG Subject: Re: pv_table/pv_entry Message-ID: <199906020306.UAA86247@apollo.backplane.com> References: <19990601180835.A27151@home.com>
next in thread | previous in thread | raw e-mail | index | archive | help
:Going through the 4.4 BSD book, I learnt that the purpose of the pv_table :is to be able to locate all the mappings to a given physical page. : :However, comparing this to the Linux approach, which chains vm_area_struct :(analogous to vm_map_entry in FreeBSD) together to locate the shared :mappings, it appears to me that the Linux approach is more space efficient. : :So why not eliminate pv_table and chain vm_map_entries together to represent :the sharing information ? : : -Arun The primary difference between the FreeBSD method and the Linux method is that the linux method takes a heavy toll in cpu by requiring a test for the page in every VM map that *might* contain that page. Since most pages in the vast majority of objects are not mapped, the FreeBSD way of doing things is typically O(1) while the linux way is O(N). This may not seem expensive, but consider what happens when you have to manipulate a *range* of pages within an object. The FreeBSD way becomes O(N) and the linux way becomes O(N^2). ( Now I'm simplifying... the FreeBSD way isn't *precisely* O(N), but neither is it anywhere near O(N^2) ). Another big difference between Linux and FreeBSD is with how page tables are maintained. Under Linux, page-tables are SWAP-BACKED. This is because Linux maintains considerable state in its page tables which cannot be recreated from other sources. Under FreeBSD, page-tables are THROW-AWAY, which means that FreeBSD can throw away elements in page tables and even whole page tables at very low cost. The FreeBSD way makes it fairly trivial for the VM system to manage pages, especially when figuring out the type of activity being performed on pages. This gives FreeBSD a significant advantage in determining which pages are good candidates to swap out or throw away. The equivalent operation under Linux is a very expensive scan of all page tables in all processes. -Matt Matthew Dillon <dillon@backplane.com> 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?199906020306.UAA86247>