From d75be7228bdb6540449d23d0256f43fce37c1cb4 Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Mon, 27 Feb 2017 13:20:36 +0900 Subject: [PATCH] PROFILE_mmap_anon_no_contig_phys: profile ANON mmap()s that couldn't be backed by contiguous physical memory --- kernel/include/profile.h | 1 + kernel/profile.c | 1 + kernel/syscall.c | 3 +++ 3 files changed, 5 insertions(+) diff --git a/kernel/include/profile.h b/kernel/include/profile.h index fbd3cfa9..2b3152c2 100644 --- a/kernel/include/profile.h +++ b/kernel/include/profile.h @@ -34,6 +34,7 @@ struct profile_event { enum profile_event_type { PROFILE_page_fault = PROFILE_EVENT_MIN, PROFILE_mpol_alloc_missed, + PROFILE_mmap_anon_no_contig_phys, PROFILE_EVENT_MAX /* Should be the last event type */ }; diff --git a/kernel/profile.c b/kernel/profile.c index 7da15ed8..6afdaa5b 100644 --- a/kernel/profile.c +++ b/kernel/profile.c @@ -59,6 +59,7 @@ char *profile_event_names[] = { "page_fault", "mpol_alloc_missed", + "mmap_anon_no_contig_phys", "" }; diff --git a/kernel/syscall.c b/kernel/syscall.c index 803cbc0d..414edd13 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -1242,6 +1242,9 @@ do_mmap(const intptr_t addr0, const size_t len0, const int prot, vrflags |= VR_DEMAND_PAGING; populated_mapping = 0; +#ifdef PROFILE_ENABLE + profile_event_add(PROFILE_mmap_anon_no_contig_phys, len); +#endif // PROFILE_ENABLE error = zeroobj_create(&memobj); if (error) { ekprintf("%s: zeroobj_create failed, error: %d\n",