Discussion:
[newlib-cygwin] Revert "Use allocation granularity as the 'page_size' in /proc/<pid>/status as well, for consistency
Corinna Vinschen
2018-08-17 18:34:23 UTC
Permalink
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ca2ec0c5cc73242a2a1d3863293c1fe647d6cc81

commit ca2ec0c5cc73242a2a1d3863293c1fe647d6cc81
Author: Corinna Vinschen <***@vinschen.de>
Date: Fri Aug 17 19:16:42 2018 +0200

Revert "Use allocation granularity as the 'page_size' in /proc/<pid>/status as well, for consistency with /proc/<pid>/statm"

This reverts commit 8a32c24a7bdb0f3d80daa8f267cc63d15edcf771.

Replacing page_size() with allocation_granularity() was incorrect.
The values returned by get_mem_values() are # of pages of size
page_size(). Multiplying with allocation_granularity() here
results in values 16 times too big.

Diff:
---
winsup/cygwin/fhandler_process.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index 8df55ec..cbadea1 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -1216,7 +1216,7 @@ format_process_status (void *data, char *&destbuf)
if (!get_mem_values (p->dwProcessId, &vmsize, &vmrss, &vmtext, &vmdata,
&vmlib, &vmshare))
return 0;
- unsigned page_size = wincap.allocation_granularity ();
+ unsigned page_size = wincap.page_size ();
vmsize *= page_size; vmrss *= page_size; vmdata *= page_size;
vmtext *= page_size; vmlib *= page_size;
/* The real uid value for *this* process is stored at cygheap->user.real_uid
Loading...