Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!pt.cs.cmu.edu!spice.cs.cmu.edu!af From: af@spice.cs.cmu.edu (Alessandro Forin) Newsgroups: comp.os.mach Subject: Re: External Pager Questions (correction) Message-ID: <8505@pt.cs.cmu.edu> Date: 20 Mar 90 16:19:03 GMT References: <823@sirius.ucs.adelaide.edu.au> Organization: Carnegie-Mellon University, CS/RI Lines: 40 I fear that the sum of my reply and Michael's caused some confusion on one point: the page alignment restrictions. I'll try to clarify it here. [All readers interested in the External Memory Interface to the VM system should try to get hold of Michael's Ph.D. thesis. I do not believe it is published yet, you'll have to ask Michael personally. Another useful (but rather terse) document is the one that appeared in the 1987 Symposium on Operating System Principles, which is part of the standard Mach doc-pack] Michael's post provides the proper view from the user-down: a user can map any memory object at any offset with the vm_map(2) call. The kernel will preserve that offset, and pass it back to the memory manager in its requests. Michael also provides the rationale for this, and how it can be used in practice. This still does not mean that Mach provides arbitrary-size operations, for instance vm_map() will still map _at least_ a page worth of data. I have provided the view from the memory manager's standpoint: kernels work on a page-size basis, and all requests the memory manager makes must be aware of this restriction. In particular, the code for memory_object_lock_request (vm/memory_object.c) does two things: 1) it round_page() the size argument 2) it page_lookup() the (object,offset) After doing this it applies the operation to all pages in the range. For instance, if you ask a kernel that has been booted with an 8k pagesize to lock the range (123,2) of the object you will effectively lock the page(s) that include that range (8k or even 16k). Do not forget this restriction, or you might be surprised. I believe the Netmemoryserver is the only example of a program that deals with the issue of serving kernels with different page sizes. It does so by chosing an (arbitrary but sensible) minimum page size internally and mapping kernel requests into multiples of its internal page size. I was definitely mistaken in saying that the offset must be page-aligned, I was obviously thinking of the size argument and got confused by the obsolete copy of the manual that I checked. The restriction on the size argument still applies, as noted above. sandro-