[PATCH 1/1] mm: introduce new field "managed_pages" to struct zone

From: Jiang Liu
Date: Wed Dec 12 2012 - 16:52:12 EST


Before this patch, zone->present_pages meant "amount of memory
(excluding holes)",
not the zone has pages in buddy system.

So I think zone->present_pages keeps its meaning as before. But it may
be abused
somewhere else, such as here.

> I think there are several parts calculates parameters based on present_pages.
>
> I myself doesn't welcome having both of compliated "managed pages" and "present pages"...
>
> How about adding
>
> static inline int managed_zone(struct zone *zone)
> {
> return (!!zone->managed_pages);
> }
>
> for this bug fix ?

Yes, adding this function could fix this problem.

And by the way, we have the following code in onine_pages():

zone->present_pages += onlined_pages;

pgdat_resize_lock(zone->zone_pgdat, &flags);
zone->zone_pgdat->node_present_pages += onlined_pages;
pgdat_resize_unlock(zone->zone_pgdat, &flags);

We should do this when the zone size is changed, not where it is now.
Will send patches for this soon.

Thanks.

>
> Other parts, using present_pages, should be considered well.
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/