Received: from eggs.gnu.org ([2001:4830:134:3::10]:43738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boueL-0004j7-Ne for qemu-devel@nongnu.org; Tue, 27 Sep 2016 11:50:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1boueI-00049j-2k for qemu-devel@nongnu.org; Tue, 27 Sep 2016 11:50:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45524) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boueH-00049c-Pu for qemu-devel@nongnu.org; Tue, 27 Sep 2016 11:50:26 -0400 References: <1474970326-10271-1-git-send-email-pl@kamp.de> <1474970326-10271-8-git-send-email-pl@kamp.de> From: Eric Blake Message-ID: <14180592-fe40-c6eb-dbe3-a38e453c5145@redhat.com> Date: Tue, 27 Sep 2016 10:50:23 -0500 MIME-Version: 1.0 In-Reply-To: <1474970326-10271-8-git-send-email-pl@kamp.de> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="OdUuijUFTTaJjeDob6OhhbHLgp0JIbAu0" Subject: Re: [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: Peter Lieven , qemu-devel@nongnu.org Cc: kwolf@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, mst@redhat.com, dgilbert@redhat.com, peter.maydell@linaro.org, rth@twiddle.net, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --OdUuijUFTTaJjeDob6OhhbHLgp0JIbAu0 From: Eric Blake To: Peter Lieven , qemu-devel@nongnu.org Cc: kwolf@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, mst@redhat.com, dgilbert@redhat.com, peter.maydell@linaro.org, rth@twiddle.net, armbru@redhat.com Message-ID: <14180592-fe40-c6eb-dbe3-a38e453c5145@redhat.com> Subject: Re: [PATCH V9 7/7] coroutine: reduce stack size to 60kB References: <1474970326-10271-1-git-send-email-pl@kamp.de> <1474970326-10271-8-git-send-email-pl@kamp.de> In-Reply-To: <1474970326-10271-8-git-send-email-pl@kamp.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/27/2016 04:58 AM, Peter Lieven wrote: > evaluation with the recently introduced maximum stack usage monitoring = revealed > that the actual used stack size was never above 4kB so allocating 1MB s= tack > 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. >=20 > Signed-off-by: Peter Lieven > --- > include/qemu/coroutine_int.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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" > =20 > -#define COROUTINE_STACK_SIZE (1 << 20) > +#define COROUTINE_STACK_SIZE 61440 Should work fine (I might have done 64k + guard page, but that's not quite as nice of a round number where the guard page is only 4k). Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --OdUuijUFTTaJjeDob6OhhbHLgp0JIbAu0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJX6pU/AAoJEKeha0olJ0Nq8c0H/jzRL4BcMZo6Vp+l2xZ9DL3H /zLt9akO1wWagFKaguQnpivqKsb+hbfPqrmqqZt5jALbJsS+EtHPBKdAWxj0nA8X PL7H0whDxczZqm8yGDpR8X6CN04U5MY2W0jykMF2cCuvpJkfjpo1grcTPZ+efK5s tlIEdCDWR+4uL29DZGH+448ds9ttsOR0P/D6TYcoKMDpT9ac1mXm6e3SHJAqZ8vq ry8KBaHysWffCogFmnFbVHAXcUTg1jx9ANV606Twz8ZZ4eK/WXU6UM50FRd73IMw dp/4QEOd8MpyyM37HgPuvhXh6qqhoLwxb958Ax8HWTDz6hEqIzkpnq9zg94zLSY= =Mk8H -----END PGP SIGNATURE----- --OdUuijUFTTaJjeDob6OhhbHLgp0JIbAu0--