From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgW9w-0005Vd-Ag for qemu-devel@nongnu.org; Mon, 28 Sep 2015 06:59:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgW9r-0008Q4-Bd for qemu-devel@nongnu.org; Mon, 28 Sep 2015 06:59:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgW9r-0008Py-6B for qemu-devel@nongnu.org; Mon, 28 Sep 2015 06:59:47 -0400 References: <1443348833-22760-1-git-send-email-mst@redhat.com> <1443348833-22760-3-git-send-email-mst@redhat.com> From: Paolo Bonzini Message-ID: <56091D9F.9040704@redhat.com> Date: Mon, 28 Sep 2015 12:59:43 +0200 MIME-Version: 1.0 In-Reply-To: <1443348833-22760-3-git-send-email-mst@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH repost 2/4] oslib: allocate PROT_NONE pages on top of RAM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Maydell , Michael Tokarev On 27/09/2015 12:14, Michael S. Tsirkin wrote: > - if (total > size) { > - munmap(ptr + size, total - size); > + if (total > size + getpagesize()) { > + munmap(ptr + size + getpagesize(), total - size - getpagesize()); > } > Please add a comment here, also noting that "total" always allocates at least an extra page, even if size is already aligned. > if (ptr) { > - munmap(ptr, size); > + munmap(ptr, size + getpagesize()); > } And another comment here. Paolo