'Ian Lance Taylor i...@google.com' via gofrontend-dev
gofrontend-...@googlegroups.com writes:
This patch from Anton Blanchard fixes libgo to adjust to the system page
size when calling madvise. Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu. Committed to mainline and 4.9 branch.
Hi, I think this patch will make my Canonical colleagues very happy (and
me when I get around to building a 64k page arm64 kernel...). It looks
to me like this is also a problem in the gc runtime library though --
should the patch be sent there too? (Apologies if it already has and I
missed it, I did look though).
Cheers,
mwh
Ian
--
You received this message because you are subscribed to the Google Groups
gofrontend-dev group.
To unsubscribe from this group and stop receiving emails from it, send an
email to gofrontend-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff -r 3a53301d24d7 libgo/runtime/mheap.c
--- a/libgo/runtime/mheap.c Tue Apr 22 16:43:35 2014 -0700
+++ b/libgo/runtime/mheap.c Thu Apr 24 21:18:35 2014 -0700
@@ -387,7 +387,7 @@
static uintptr
scavengelist(MSpan *list, uint64 now, uint64 limit)
{
- uintptr released, sumreleased;
+ uintptr released, sumreleased, start, end, pagesize;
MSpan *s;
if(runtime_MSpanList_IsEmpty(list))
@@ -400,7 +400,17 @@
mstats.heap_released += released;
sumreleased += released;
s-npreleased = s-npages;
- runtime_SysUnused((void*)(s-start PageShift),
s-npages PageShift);
+
+ start = s-start PageShift;
+ end = start + (s-npages PageShift);
+
+ // Round start up and end down to ensure we
+ // are acting on entire pages.
+ pagesize = getpagesize();
+ start = ROUND(start, pagesize);
+ end = ~(pagesize - 1);
+ if(end start)
+ runtime_SysUnused((void*)start, end - start);
}
}
return sumreleased;