Messages in this thread |  | | From | (Pascal Haible) | Subject | Re: do_mmap() | Date | 18 Nov 1996 13:07:36 GMT |
| |
In article <199611161838.NAA14616@mindbender.Princeton.EDU>, David L. Oppenheimer <davido@cs.princeton.edu> wrote: >Does anyone know what the purpose of this piece of code is? (It appears at the >end of do_mmap() in mm/mmap.c)
> if (flags & VM_LOCKED) { > unsigned long start = addr; > mm->locked_vm += len >> PAGE_SHIFT; > do { > char c = get_user((char *) start); > len -= PAGE_SIZE; > start += PAGE_SIZE; > __asm__ __volatile__("": :"r" (c)); > } while (len > 0); > }
If the vm area is LOCKED in core e.g. for realtime purposes, it will touch any of the pages by reading a byte from them. IMHO, this is not strictly true, it should touch the pages by _writing_ , as this makes a difference on zero pages: imagine a realtime process that has malloced a large chunk (with a mmap based malloc), mlocks it, and then uses it - if memory is tight, it will nevertheless cause swapping activity, which is what it wanted to prevent by mlocking it.
Pascal -- Pascal Haible, haible@ITO.Uni-Stuttgart.DE
|  |