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] page_alloc query

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] page_alloc query
From: Ben Thomas <bthomas@xxxxxxxxxxxxxxx>
Date: Tue, 06 Mar 2007 17:10:32 -0500
Delivery-date: Tue, 06 Mar 2007 14:09:37 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.10 (X11/20070302)
Hi,

The following code is causing some questions.  Perhaps someone could
help explain it...  (xen/common/page_alloc.c)

Why are the zones unsigned ints when they are used as indices ?
The ASSERTS do checks to keep you out of some amount of
trouble, but the loop appears to be able to get you quickly
into trouble by driving the index negative and with a check
that doesn't appear to be effective.

static struct page_info *alloc_heap_pages(
    unsigned int zone_lo, unsigned zone_hi,
    unsigned int cpu, unsigned int order)
{
.
.
.
    ASSERT(zone_lo <= zone_hi);
    ASSERT(zone_hi < NR_ZONES);
.
.
.

        for ( zone = zone_hi; zone >= zone_lo; --zone )
        {
            /* check if target node can support the allocation */
            if ( avail[node] && (avail[node][zone] >= request) )

Has it just been a long day and I'm not reading this correctly ?
The older version of this code didn't appear to operate in this
fashion.  Is a simple change of unsigned -> signed sufficient here ?
(While it has been a long day, and it could be failing neurons,
this code has just crashed recently due to a bad index, so....)

I have to run, and can't fix this right now, so I'll settle for this
query.

Thanks,
-b


--
------------------------------------------------------------------------
Ben Thomas                                         Virtual Iron Software
bthomas@xxxxxxxxxxxxxxx                            Tower 1, Floor 2
978-849-1214                                       900 Chelmsford Street
                                                   Lowell, MA 01851

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>