Re: [PATCH 07/22] Calculate the preferred zone for allocation only once

Andrew Morton
2009-04-23T22:54:40Z

On Wed, 22 Apr 2009 14:53:12 +0100
Mel Gorman <mel@csn.ul.ie> wrote:

> get_page_from_freelist() can be called multiple times for an allocation.
> Part of this calculates the preferred_zone which is the first usable zone
> in the zonelist but the zone depends on the GFP flags specified at the
> beginning of the allocation call. This patch calculates preferred_zone
> once. It's safe to do this because if preferred_zone is NULL at the start
> of the call, no amount of direct reclaim or other actions will change the
> fact the allocation will fail.
>
>
> ...
>
> - (void)first_zones_zonelist(zonelist, high_zoneidx, nodemask,
> -
> &preferred_zone);
> ...
>
> + /* The preferred zone is used for statistics later */
> + (void)first_zones_zonelist(zonelist, high_zoneidx, nodemask,

Let's quietly zap that dopey cast.

--- a/mm/page_alloc.c~page-allocator-calculate-the-preferred-zone-for-allocation-only-once-fix
+++ a/mm/page_alloc.c
@@ -1775,8 +1775,7 @@ __alloc_pages_nodemask(gfp_t gfp_mask, u
return NULL;

/* The preferred zone is used for statistics later */
- (void)first_zones_zonelist(zonelist, high_zoneidx, nodemask,
- &preferred_zone);
+ first_zones_zonelist(zonelist, high_zoneidx, nodemask, &preferred_zone);
if (!preferred_zone)
return NULL;

_