Re: [RFC PATCH 1/2] vmscan don't isolate too many pages

From: Minchan Kim
Date: Tue Jul 07 2009 - 19:39:25 EST


On Tue, Jul 7, 2009 at 6:47 PM, KOSAKI
Motohiro<kosaki.motohiro@xxxxxxxxxxxxxx> wrote:
> Subject: [PATCH] vmscan don't isolate too many pages
>
> If the system have plenty threads or processes, concurrent reclaim can
> isolate very much pages.
>
> And if other processes isolate _all_ pages on lru, the reclaimer can't find
> any reclaimable page and it makes accidental OOM.
>
> The solusion is, we should restrict maximum number of isolated pages.
> (this patch use inactive_page/2)
>
>
> FAQ
> -------
> Q: Why do you compared zone accumulate pages, not individual zone pages?
> A: If we check individual zone, #-of-reclaimer is restricted by smallest zone.
> Â it mean decreasing the performance of the system having small dma zone.
>
>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
> ---
> Âmm/page_alloc.c | Â 27 +++++++++++++++++++++++++++
> Â1 file changed, 27 insertions(+)
>
> Index: b/mm/page_alloc.c
> ===================================================================
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1721,6 +1721,28 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
> Â Â Â Âreturn alloc_flags;
> Â}
>
> +static bool too_many_isolated(struct zonelist *zonelist,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â enum zone_type high_zoneidx, nodemask_t *nodemask)
> +{
> + Â Â Â unsigned long nr_inactive = 0;
> + Â Â Â unsigned long nr_isolated = 0;
> + Â Â Â struct zoneref *z;
> + Â Â Â struct zone *zone;
> +
> + Â Â Â for_each_zone_zonelist_nodemask(zone, z, zonelist,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â high_zoneidx, nodemask) {
> + Â Â Â Â Â Â Â if (!populated_zone(zone))
> + Â Â Â Â Â Â Â Â Â Â Â continue;
> +
> + Â Â Â Â Â Â Â nr_inactive += zone_page_state(zone, NR_INACTIVE_ANON);
> + Â Â Â Â Â Â Â nr_inactive += zone_page_state(zone, NR_INACTIVE_FILE);
> + Â Â Â Â Â Â Â nr_isolated += zone_page_state(zone, NR_ISOLATED_ANON);
> + Â Â Â Â Â Â Â nr_isolated += zone_page_state(zone, NR_ISOLATED_FILE);
> + Â Â Â }
> +
> + Â Â Â return nr_isolated > nr_inactive;
> +}
> +
> Âstatic inline struct page *
> Â__alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
> Â Â Â Âstruct zonelist *zonelist, enum zone_type high_zoneidx,
> @@ -1789,6 +1811,11 @@ rebalance:
> Â Â Â Âif (p->flags & PF_MEMALLOC)
> Â Â Â Â Â Â Â Âgoto nopage;
>
> + Â Â Â if (too_many_isolated(gfp_mask, zonelist, high_zoneidx, nodemask)) {

too_many_isolated(zonelist, high_zoneidx, nodemask)

--
Kind regards,
Minchan Kim
--
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/