Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!sri-spam!ames!ptsfa!hoptoad!academ!killer!jfh From: jfh@killer.UUCP (John Haugh) Newsgroups: comp.unix.wizards Subject: Re: Why "u." and not "u->" ? (I'm reading Bach book) Message-ID: <885@killer.UUCP> Date: Thu, 14-May-87 18:32:36 EDT Article-I.D.: killer.885 Posted: Thu May 14 18:32:36 1987 Date-Received: Sat, 23-May-87 04:23:58 EDT References: <626@vixie.UUCP> <3568@spool.WISC.EDU> Organization: The Unix(tm) Connection, Dallas, Texas Lines: 33 Summary: U page may move in physical memory In article <3568@spool.WISC.EDU>, lm@cottage.WISC.EDU (Larry McVoy) writes: > In article <626@vixie.UUCP> paul@vixie.UUCP (Paul Vixie Esq) writes: > >re-map the page, and is the trade-off worth it? Just how much is 'u.' used > >between context switches, anyway? > > I daresay that it used every single time you enter the kernel for a > system call (note: system call not system entry - drivers shouldn't > pook about in the u struct 'cause it's probably someone elses). > > Larry McVoy lm@cottage.wisc.edu or uwvax!mcvoy I'm not sure this is the best reason for keeping the U page fixed in kernel virtual memory - but it seems to be a _very_ good one. If you get swapped in the middle of a system call, such as a terminal read, when you are swapped back in your U page may reside at a different physical address. On PDP-11's the U page was fixed at 0140000 in Kernel D space. I forget how they convinced the linker to give that address to _u when unix was linked. Also, I don't think it is possible to make _u a pointer to the struct user as you could get swapped after the pointer value was fetched, but before it was used. (Like this) movl _u,r0 ; get address of U page from pointer - interupt - swap out and wait for a while - swap in somewheres else - movl u_error(r0),r0 ; r0 now has wrong address ... I don't know if all of the schedulers are capable of this kind of mess, but it seems that something like this could happen. - John. (jfh@killer.UUCP) Disclaimer - No disclaimer. Whatcha gonna do, sue me?