"Data Read-In-Place" is of interest to CE Linux Forum members, because it allows data pages to reside on ROM or flash, until they are written to. This is essentially a form of XIP, or copy-on-write, for data pages. XIP is used to keep text segment pages in flash permanently. This technique ("DRIP") is used to keep data pages in flash until they are written to. Since many application data pages are never written to, the net effect is a substantial reduction in RAM usage for application data segments. This feature was also called "Data Allocate On Write" previously, but the name "Data Read In Place" is closer to the already-existing term for text (Execute In Place), and is now preferred. The total effect for one system measured by Panasonic was a reduction of 26% of the page cache allocated to processes, when the product was in the stand-by state. The technique was described by Masashige Mizuyama, Chief Architect in the System Architecture Develompent Group, Base System Development Center, Panasonic Mobile Communications Co., Ltd. Refernce: http://tree.celinuxforum.org/CelfPubWiki/DataReadInPlace --- glibc-2.3.2-orig/elf/dl-load.c 2006-10-16 10:38:44.000000000 +0800 +++ glibc-2.3.2/elf/dl-load.c 2006-10-17 01:07:56.000000000 +0800 @@ -801,19 +801,63 @@ const char* map_lock (int locked_load_mo if (! (locked_load_mode & (RTLD_LOCK_DEPENDENT_LIB_PAGES | RTLD_LOCK_LIB_PAGES))) { - mapat = __mmap ((caddr_t) mapstart, len, prot, - fixed|MAP_COPY|MAP_FILE, - fd, offset); - if (mapat == MAP_FAILED) - return N_("failed to map segment from shared object"); + if ((prot & PROT_WRITE) != 0 ) + { + prot = (prot & ~PROT_WRITE); + mapat = __mmap ((caddr_t) mapstart, len, prot, + fixed|MAP_COPY|MAP_FILE, + fd, offset); + if (mapat != MAP_FAILED) + { + prot = (prot | PROT_WRITE); + if (__mprotect(mapat, len, prot) == -1) + { + return N_("failed to map segment from shared object"); + } + } + else + { + return N_("failed to map segment from shared object"); + } + } + else + { + mapat = __mmap ((caddr_t) mapstart, len, prot, + fixed|MAP_COPY|MAP_FILE, + fd, offset); + if (mapat == MAP_FAILED) + return N_("failed to map segment from shared object"); + } } else if (locked_load_mode & RTLD_LOCK_MLOCK) { - mapat = __mmap ((caddr_t) mapstart, len, prot, + if ((prot & PROT_WRITE) != 0) + { + prot = (prot & ~PROT_WRITE); + mapat = __mmap ((caddr_t) mapstart, len, prot, + fixed|MAP_COPY|MAP_FILE, + fd, offset); + if (mapat != MAP_FAILED) + { + prot = (prot | PROT_WRITE); + if (__mprotect(mapat,len,prot) == -1) + { + return N_("failed to map segment from shared object"); + } + } + else + { + return N_("failed to map segment from shared object"); + } + } + else + { + mapat = __mmap ((caddr_t) mapstart, len, prot, fixed|MAP_COPY|MAP_FILE, fd, offset); - if (mapat == MAP_FAILED) - return N_("failed to map segment from shared object"); + if (mapat == MAP_FAILED) + return N_("failed to map segment from shared object"); + } if (mlock((caddr_t) mapat, len) != 0) { return N_("failed to memory lock segment from shared object");