commit 7ad414f76f03f26fd148bf4100a83e238ac7af72
Author: Nishanth Aravamudan <[EMAIL PROTECTED]>
Date: Fri Feb 2 15:08:34 2007 -0800
elflink: store extracopy information
Add a few fields to the seg_info structure to store the starting address
and size of the extracopy area for use by the next patch to drop
pagecache pages. If the extra_start field is NULL, then the pagecache
dropping code assumes this means there was no extracopy area. This
version stores the beginning and ending addresses of the extracopy area.
Signed-off-by: Nishanth Aravamudan <[EMAIL PROTECTED]>
diff --git a/elflink.c b/elflink.c
index 5a57358..dad3ea7 100644
--- a/elflink.c
+++ b/elflink.c
@@ -186,7 +186,7 @@ static char share_path[PATH_MAX+1];
#define MAX_HTLB_SEGS 2
struct seg_info {
- void *vaddr;
+ void *vaddr, *extra_start, *extra_end;
unsigned long filesz, memsz;
int prot;
int fd;
@@ -497,8 +497,7 @@ static inline int keep_symbol(Elf_Sym *s, void *start, void
*end)
* include these initialized variables in our copy.
*/
-static void get_extracopy(struct seg_info *seg, void **extra_start,
- void **extra_end)
+static void get_extracopy(struct seg_info *seg)
{
Elf_Dyn *dyntab; /* dynamic segment table */
Elf_Sym *symtab = NULL; /* dynamic symbol table */
@@ -557,21 +556,21 @@ static void get_extracopy(struct seg_info *seg, void
**extra_start,
if (found_sym) {
/* Return the copy window */
- *extra_start = start;
- *extra_end = end;
+ seg->extra_start = start;
+ seg->extra_end = end;
return;
} else {
/* No need to copy anything */
- *extra_start = start_orig;
- *extra_end = start_orig;
+ seg->extra_start = start_orig;
+ seg->extra_end = start_orig;
goto bail3;
}
bail:
DEBUG("Unable to perform minimal copy\n");
bail2:
- *extra_start = start_orig;
- *extra_end = end_orig;
+ seg->extra_start = start_orig;
+ seg->extra_end = end_orig;
bail3:
return;
}
@@ -584,17 +583,17 @@ bail3:
static int prepare_segment(struct seg_info *seg)
{
int hpage_size = gethugepagesize();
- void *p, *extra_start, *extra_end;
+ void *p;
unsigned long gap;
- unsigned long size;
+ unsigned long size, extra_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);
+ get_extracopy(seg);
+ size = ALIGN((unsigned long)(seg->extra_end - seg->vaddr),
+ hpage_size);
/* Prepare the hugetlbfs file */
@@ -617,11 +616,14 @@ static int prepare_segment(struct seg_info *seg)
memcpy(p, seg->vaddr, seg->filesz);
DEBUG_CONT("done\n");
- if (extra_end > extra_start) {
+ if (seg->extra_end > seg->extra_start) {
+ extra_size = (unsigned long)(seg->extra_end -
+ seg->extra_start);
DEBUG("Copying extra %#0lx bytes from %p...",
- (unsigned long)(extra_end - extra_start), extra_start);
- gap = extra_start - (seg->vaddr + seg->filesz);
- memcpy((p + seg->filesz + gap), extra_start, (extra_end -
extra_start));
+ extra_size, seg->extra_start);
+ gap = seg->extra_start - (seg->vaddr + seg->filesz);
+ memcpy((p + seg->filesz + gap), seg->extra_start,
+ extra_size);
DEBUG_CONT("done\n");
}
--
Nishanth Aravamudan <[EMAIL PROTECTED]>
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel