elflink: Reduce the shared mapping to filesz + non-zero BSS. This should decrease the number of huge pages we reserve.
Signed-off-by: Steve Fox <[EMAIL PROTECTED]> --- This is unchanged from the earlier submission, but it has been regression tested now. diff --git a/elflink.c b/elflink.c index 41a1fe9..9225010 100644 --- a/elflink.c +++ b/elflink.c @@ -393,7 +393,15 @@ static int prepare_segment(struct seg_in int hpage_size = gethugepagesize(); void *p, *extra_start, *extra_end; unsigned long gap; - unsigned long size = ALIGN(seg->memsz, hpage_size); + unsigned long size; + + /* + * Calculate the BSS size that we must copy in order to minimize + * the size of the shared mapping. + */ + get_extracopy(seg, &extra_start, &extra_end); + size = ALIGN((unsigned long)extra_end - (unsigned long)seg->vaddr, + hpage_size); /* Prepare the hugetlbfs file */ @@ -416,7 +424,6 @@ static int prepare_segment(struct seg_in memcpy(p, seg->vaddr, seg->filesz); DEBUG_CONT("done\n"); - get_extracopy(seg, &extra_start, &extra_end); if (extra_end > extra_start) { DEBUG("Copying extra %#0lx bytes from %p...\n", (unsigned long)(extra_end - extra_start), extra_start); -- Steve Fox IBM Linux Technology Center ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Libhugetlbfs-devel mailing list Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel