From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bopAQ-0007op-8n for qemu-devel@nongnu.org; Tue, 27 Sep 2016 05:59:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bopAP-00078v-DG for qemu-devel@nongnu.org; Tue, 27 Sep 2016 05:59:14 -0400 Received: from mx01.kamp.de ([82.141.2.16]:43410) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bopAP-00078Q-4P for qemu-devel@nongnu.org; Tue, 27 Sep 2016 05:59:13 -0400 From: Peter Lieven Date: Tue, 27 Sep 2016 11:58:46 +0200 Message-Id: <1474970326-10271-8-git-send-email-pl@kamp.de> In-Reply-To: <1474970326-10271-1-git-send-email-pl@kamp.de> References: <1474970326-10271-1-git-send-email-pl@kamp.de> Subject: [Qemu-devel] [PATCH V9 7/7] coroutine: reduce stack size to 60kB List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, mst@redhat.com, dgilbert@redhat.com, peter.maydell@linaro.org, eblake@redhat.com, rth@twiddle.net, armbru@redhat.com, Peter Lieven evaluation with the recently introduced maximum stack usage monitoring revealed that the actual used stack size was never above 4kB so allocating 1MB stack for each coroutine is a lot of wasted memory. So reduce the stack size to 60kB which should still give enough head room. The guard page added in qemu_alloc_stack will catch a potential stack overflow introduced by this commit. The 60kB + guard page will result in an allocation of 64kB per coroutine on systems where a page is 4kB. Signed-off-by: Peter Lieven --- include/qemu/coroutine_int.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/qemu/coroutine_int.h b/include/qemu/coroutine_int.h index 14d4f1d..be14260 100644 --- a/include/qemu/coroutine_int.h +++ b/include/qemu/coroutine_int.h @@ -28,7 +28,7 @@ #include "qemu/queue.h" #include "qemu/coroutine.h" -#define COROUTINE_STACK_SIZE (1 << 20) +#define COROUTINE_STACK_SIZE 61440 typedef enum { COROUTINE_YIELD = 1, -- 1.9.1