From 4cee9b1a27fc50609b4b1269f666a348aa07a6da Mon Sep 17 00:00:00 2001 From: Masamichi Takagi Date: Thu, 4 Jul 2019 13:29:04 +0900 Subject: [PATCH] rusage: Add comment on counting COW-source pointed-to by only fileobj Change-Id: I082f6738dd29257c05e8a0e4b0af23dd8ffab449 --- kernel/process.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kernel/process.c b/kernel/process.c index 1fe233f1..b63dba69 100644 --- a/kernel/process.c +++ b/kernel/process.c @@ -2013,9 +2013,16 @@ retry: __FUNCTION__, virt, phys_to_virt(phys), virt_to_phys(virt), phys, pgsize); memcpy(virt, phys_to_virt(phys), pgsize); - /* Call rusage_memory_stat_add() because remote page fault may create a page not pointed-to by PTE */ - if(rusage_memory_stat_add(range, phys, pgsize, pgsize)) { - dkprintf("%lx+,%s: remote page fault + cow, calling memory_stat_rss_add(),pgsize=%ld\n", + /* Count COW-source pointed-to by only fileobj + * The steps in test/rusage/005: + * (1) Private-map regular file + * (2) Don't touch the page + * (3) Fork and then the child touches the page + * (4) Page-in the COW-source + * (5) Reach here + */ + if (rusage_memory_stat_add(range, phys, pgsize, pgsize)) { + dkprintf("%lx+,%s: COW-source pointed-to by only fileobj, calling memory_stat_rss_add(),pgsize=%ld\n", phys, __FUNCTION__, pgsize); } if (page) {