aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/mem_linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/mem_linux.c')
-rw-r--r--src/pkg/runtime/mem_linux.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pkg/runtime/mem_linux.c b/src/pkg/runtime/mem_linux.c
index d96eb69e89..b0f2956335 100644
--- a/src/pkg/runtime/mem_linux.c
+++ b/src/pkg/runtime/mem_linux.c
@@ -50,11 +50,10 @@ mmap_fixed(byte *v, uintptr n, int32 prot, int32 flags, int32 fd, uint32 offset)
}
void*
-runtime·SysAlloc(uintptr n)
+runtime·SysAlloc(uintptr n, uint64 *stat)
{
void *p;
- mstats.sys += n;
p = runtime·mmap(nil, n, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0);
if(p < (void*)4096) {
if(p == (void*)EACCES) {
@@ -68,6 +67,7 @@ runtime·SysAlloc(uintptr n)
}
return nil;
}
+ runtime·xadd64(stat, n);
return p;
}
@@ -85,9 +85,9 @@ runtime·SysUsed(void *v, uintptr n)
}
void
-runtime·SysFree(void *v, uintptr n)
+runtime·SysFree(void *v, uintptr n, uint64 *stat)
{
- mstats.sys -= n;
+ runtime·xadd64(stat, -(uint64)n);
runtime·munmap(v, n);
}
@@ -118,11 +118,11 @@ runtime·SysReserve(void *v, uintptr n)
}
void
-runtime·SysMap(void *v, uintptr n)
+runtime·SysMap(void *v, uintptr n, uint64 *stat)
{
void *p;
- mstats.sys += n;
+ runtime·xadd64(stat, n);
// On 64-bit, we don't actually have v reserved, so tread carefully.
if(sizeof(void*) == 8 && (uintptr)v >= 0xffffffffU) {