[sheepdog] [PATCH] local: do not zero the event queue

Christoph Hellwig hch at infradead.org
Sun May 20 19:51:33 CEST 2012


Reading, including through mmap from sparse files always returns zeroes,
so there is no need to memset the shm queue.  Zeroing it causes backing
pages to be allocated to it in tmpfs, and thus increases the memory
usage for a not fully used queue.

Signed-off-by: Christoph Hellwig <hch at lst.de>

---
 sheep/cluster/local.c |    1 -
 1 file changed, 1 deletion(-)

Index: sheepdog/sheep/cluster/local.c
===================================================================
--- sheepdog.orig/sheep/cluster/local.c	2012-05-20 16:18:51.094558848 +0200
+++ sheepdog/sheep/cluster/local.c	2012-05-20 19:39:17.768023684 +0200
@@ -200,7 +200,6 @@ static void shm_queue_init(void)
 	else {
 		/* initialize shared memory */
 		event_pos = 0;
-		memset(shm_queue, 0, sizeof(*shm_queue));
 		ret = ftruncate(shmfd, 0);
 		assert(ret == 0);
 		ret = ftruncate(shmfd, sizeof(*shm_queue));



More information about the sheepdog mailing list