On Wed, 2007-02-07 at 11:37 -0800, Nishanth Aravamudan wrote:
> @@ -831,6 +832,57 @@ static void remap_segments(struct seg_info *seg, int num)
> /* The segments are all back at this point.
> * and it should be safe to reference static data
> */
> +
> + /*
> + * This pagecache dropping code should not be used for shared
> + * segments. But we currently only share read-only segments, so
> + * the below check for PROT_WRITE is implicitly sufficient.
> + *
> + * Note: if minimal_copy is enabled, it is overkill to try and
> + * save huge pages here, as we will end up using more than
> + * normal anyways. Also, due to limitations on certain
> + * architectures, we would need to avoid prefaulting in the
> + * extracopy area so as to not use an inordinate number of huge
> + * pages.
> + */
> + if (minimal_copy) {
Now the added indent is really making me want to say this is getting
large enough to want its own function. I think the previous patch to
store the extracopy info in the seg array allows you to pass only one
param (the seg array) into the drop_cache() function.
> + for (i = 0; i < num; i++) {
> + if (seg[i].prot & PROT_WRITE) {
> + /*
> + * take a COW fault on each hugepage in
> + * the segment's file data ...
> + */
> + for (p = seg[i].vaddr;
> + p <= seg[i].vaddr + seg[i].filesz;
> + p += hpage_size) {
> + memcpy(&c, p, 1);
> + memcpy(p, &c, 1);
> + }
> + /*
> + * ... as well as each huge page in the
> + * extracopy area
> + *
> + */
> + if (seg[i].extra_vaddr) {
> + for (p = seg[i].extra_vaddr;
> + p <= seg[i].extra_vaddr +
> + seg[i].extrasz;
> + p += hpage_size) {
> + memcpy(&c, p, 1);
> + memcpy(p, &c, 1);
> + }
> + }
> + /*
> + * Note: fadvise() failing is not
> + * actually an error, as we'll just use
> + * an extra set of hugepages (in the
> + * pagecache).
> + */
> + posix_fadvise(seg[i].fd, 0, 0,
> + POSIX_FADV_DONTNEED);
> + }
> + }
> + }
> }
>
> static int check_env(void)
>
--
Adam Litke - (agl at us.ibm.com)
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