WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] safely calculate page number from maxmem

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] safely calculate page number from maxmem
From: aq <aquynh@xxxxxxxxx>
Date: Sun, 17 Jul 2005 12:59:29 +0900
Delivery-date: Sun, 17 Jul 2005 03:58:07 +0000
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type; b=d5rQjxfdS5+IFTSf1PhLJ9kEEm5To6ir9bxY/KbK0zDDQ3g4ainF2VbXM5E+M9PXpes/c3LuIuss53byJVI8m2QF9ZWyPCRLWAvKhV26QBRTpH7oEOS9tIqSkPiKoV+FkNPxFSQ2RurTPvPk/2UhFQjdIyk00BtGRNoJ62p3ibE=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: aq <aquynh@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Currently we convert from maxmemkb to pages this way:

pages = max_memkb >> (PAGE_SHIFT - 10)

But I guess it is safer to do it like this (for more cautions and we
lose nothing anyway):

pages = (max_memkb + (1 << (PAGE_SHIFT-10)) - 1) >> (PAGE_SHIFT - 10)



Signed-off-by Nguyen Anh Quynh <aquynh@xxxxxxxxx>


$ diffstat maxmem2.patch 
 tools/libxc/xc_linux_save.c |    2 +-
 xen/common/dom0_ops.c       |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Attachment: maxmem2.patch
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] safely calculate page number from maxmem, aq <=