[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • 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=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.