hi Yiteng, On Mon, Jul 22, 2019 at 03:23:08PM -0400, Jonathan Rajotte-Julien wrote: > Hi Yiteng, > > On Mon, Jul 22, 2019 at 02:44:09PM -0400, Yiteng Guo wrote: > > Hi Jonathan, > > > > I spent these days on this problem and finally figured it out. Here > > are patches I've written. > > Sorry for that, I had other stuff ongoing. > > I had a brief discussion about this with Mathieu Desnoyers. > > Mathieu mentioned that the page faults you are seeing might be related to > qemu/kvm usage of KSM [1]. I did not have time to play around with it and see > if > this indeed have an effect. You might be better off trying it since you are > already all setup. Might want to disable it and retry your experiment (if only > doing this on a vm).
Disregard all of this for now. I think we misunderstood the first email and got too far too fast. I modified lttng-ust to use MAP_POPULATE and based on the result from the page_fault perf counter it seems to achieve what you are looking for. See attached patch. Let me know if this help. Cheers. -- Jonathan Rajotte-Julien EfficiOS
>From 2b065e5988067291e3367f413571248f4551acb2 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte <jonathan.rajotte-jul...@efficios.com> Date: Mon, 22 Jul 2019 17:37:43 -0400 Subject: [PATCH lttng-ust] Use MAP_POPULATE to reduce pagefault Signed-off-by: Jonathan Rajotte <jonathan.rajotte-jul...@efficios.com> --- libringbuffer/shm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libringbuffer/shm.c b/libringbuffer/shm.c index 10b3bcef..489322e6 100644 --- a/libringbuffer/shm.c +++ b/libringbuffer/shm.c @@ -154,7 +154,7 @@ struct shm_object *_shm_object_table_alloc_shm(struct shm_object_table *table, /* memory_map: mmap */ memory_map = mmap(NULL, memory_map_size, PROT_READ | PROT_WRITE, - MAP_SHARED, shmfd, 0); + MAP_SHARED | MAP_POPULATE, shmfd, 0); if (memory_map == MAP_FAILED) { PERROR("mmap"); goto error_mmap; @@ -341,7 +341,7 @@ struct shm_object *shm_object_table_append_shm(struct shm_object_table *table, /* memory_map: mmap */ memory_map = mmap(NULL, memory_map_size, PROT_READ | PROT_WRITE, - MAP_SHARED, shm_fd, 0); + MAP_SHARED | MAP_POPULATE, shm_fd, 0); if (memory_map == MAP_FAILED) { PERROR("mmap"); goto error_mmap; -- 2.17.1
_______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev