Messages in this thread | | | From | Snow Cat <> | Subject | mmove? | Date | Sun, 24 Mar 1996 10:04:16 -0800 (PST) |
| |
Hi,
I believe that the semantics provided by mremap(region, old_size, new_size, canmove) is not optimal, because it doesn't give a process enough control over virtual memory. We should implement memory mapping calls that will be useful for a variety of applications, not just malloc:
mcheck(caddr_t *addr, size_t *len, int *prot, int *flags) - find the first existing memory map in the range addr..(addr+len) and return it's parameters to the caller.
mcopy(caddr_t addr, size_t len, caddr_t *newaddr, int flags) -
copy memory pages to a new address. The flags can include MAP_FIXED to control handling of newaddr as well as copy type, such as:
MAP_COPY - make a copy-on-write duplicate of <addr,len> mapping. MAP_ALIAS - make <newaddr, len> an alias for <addr,len> such as changing one of them changes the other. MAP_MOVE - move pages to a new location and delete old mapping.
Library functions such as memcpy could use mcopy with MAP_COPY to speed up handling large regions of memory. mremap can also be implemented in libc using mcheck, mcopy and mmap.
Btw, I don't claim this is the best semantics. MACH has a comprehansive set of memory management functions (vm_allocate and friends). Can anyone look at it and see if it can be adopted in Linux? -- Snow ^oo^ Cat <snowcat@math.CSUFresno.EDU> _ -> <- aka Oleg Kibirev <oleg@math.CSUFresno.EDU> ___(_) _ _)_ / _) finger oleg@math.math.CSUFresno.EDU for PGP public key \_.-._ |___/ Purr!
| |