*BSD News Article 1791


Return to BSD News archive

Xref: sserve comp.unix.bsd:1824 comp.unix.wizards:26071 comp.unix.questions:24032
Path: sserve!manuel!munnari.oz.au!uunet!mcsun!sunic2!dkuug!diku!thorinn
From: thorinn@diku.dk (Lars Henrik Mathiesen)
Newsgroups: comp.unix.bsd,comp.unix.wizards,comp.unix.questions
Subject: Re: 4.3bsd Usrptmap
Message-ID: <1992Jul2.153256.2796@odin.diku.dk>
Date: 2 Jul 92 15:32:56 GMT
References: <l4et57INN34i@ack.cs.utexas.edu> <24291@dog.ee.lbl.gov>
Sender: thorinn@tyr.diku.dk
Organization: Department of Computer Science, U of Copenhagen
Lines: 40

>yau@cs.utexas.edu (King-Yeung Yau) writes:
>>Hi, In 4.3BSD Unix, there is a data structure called Usrptmap, which
>>is in addition to the user page tables. I don't quite understand the
>>purpose of this data structure. Why isn't it sufficient to allocate
>>only User page tables in kernel virtual address space using a resource
>>map?

The user page tables _are_ allocated from a lump of kernel virtual
address space called |usrpt|, using a resource map, and as far as
virtual addresses are concerned, that is all there is to it.

|Usrptmap| is a convenience name that makes it easier to manipulate
the kernel virtual to physical mapping of |usrpt|. It is part of the
(statically allocated) first level page table, and because of the way
the VAX works, that memory has to be set aside for |usrpt| to be
usable.

The trick is, |usrpt| is not backed by physical memory until a process
actually needs a page table. When that happens, some physical pages
are allocated, and |Usrptmap| is where the page table entries go.
Having easy access to those entries is convenient; for example, when a
page table has to be expanded, the entries in |Usrptmap| that map the
stack region can just be shuffled up, and then only part of one page
of the page table itself has to be copied; similarly, if a process'
page table has to be moved to another part of |usrpt| (because it no
longer fits where it is) the physical pages do not have to be moved,
they are just remapped.

torek@horse.ee.lbl.gov (Chris Torek) writes:
>Usrptmap[] is the page table that maps the user page tables.  This
>first-level page table must be in physically contiguous memory (per
>the VAX architecture).  The easiest way to do that was to make it
>static duration.  The kernel memory allocators do not arrange for
>contiguous physical pages.

That is very correct, but not an answer to the question. Besides,
using a kernel memory allocator would work, but would make it much
messier to fiddle with the mapping.

Lars Mathiesen (U of Copenhagen CS Dep) <thorinn@diku.dk> (Humour NOT marked)