Re: [PATCH] vmscan: check all_unreclaimable in direct reclaim path

From: Dave Young
Date: Fri Sep 10 2010 - 04:24:11 EST


On Thu, Sep 9, 2010 at 6:19 AM, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Thu, 9 Sep 2010 00:45:27 +0900
> Minchan Kim <minchan.kim@xxxxxxxxx> wrote:
>
>> +static inline bool zone_reclaimable(struct zone *zone)
>> +{
>> + Â Â return zone->pages_scanned < zone_reclaimable_pages(zone) * 6;
>> +}
>> +
>> +static inline bool all_unreclaimable(struct zonelist *zonelist,
>> + Â Â Â Â Â Â struct scan_control *sc)
>> +{
>> + Â Â struct zoneref *z;
>> + Â Â struct zone *zone;
>> + Â Â bool all_unreclaimable = true;
>> +
>> + Â Â if (!scanning_global_lru(sc))
>> + Â Â Â Â Â Â return false;
>> +
>> + Â Â for_each_zone_zonelist_nodemask(zone, z, zonelist,
>> + Â Â Â Â Â Â Â Â Â Â gfp_zone(sc->gfp_mask), sc->nodemask) {
>> + Â Â Â Â Â Â if (!populated_zone(zone))
>> + Â Â Â Â Â Â Â Â Â Â continue;
>> + Â Â Â Â Â Â if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL))
>> + Â Â Â Â Â Â Â Â Â Â continue;
>> + Â Â Â Â Â Â if (zone_reclaimable(zone)) {
>> + Â Â Â Â Â Â Â Â Â Â all_unreclaimable = false;
>> + Â Â Â Â Â Â Â Â Â Â break;
>> + Â Â Â Â Â Â }
>> + Â Â }
>> +
>> Â Â Â return all_unreclaimable;
>> Â}
>
> Could we have some comments over these functions please? ÂWhy they
> exist, what problem they solve, how they solve them, etc. ÂStuff which
> will be needed for maintaining this code three years from now.
>
> We may as well remove the `inline's too. Âgcc will tkae care of that.
>
>> - Â Â Â Â Â Â if (nr_slab == 0 &&
>> - Â Â Â Â Â Â Â Âzone->pages_scanned >= (zone_reclaimable_pages(zone) * 6))
>> + Â Â Â Â Â Â if (nr_slab == 0 && !zone_reclaimable(zone))
>
> Extra marks for working out and documenting how we decided on the value
> of "6". ÂSigh. ÂIt's hopefully in the git record somewhere.

Here it is (necessary to add additional comment?):

commit 4ff1ffb4870b007b86f21e5f27eeb11498c4c077
Author: Nick Piggin <npiggin@xxxxxxx>
Date: Mon Sep 25 23:31:28 2006 -0700

[PATCH] oom: reclaim_mapped on oom

Potentially it takes several scans of the lru lists before we can even start
reclaiming pages.

mapped pages, with young ptes can take 2 passes on the active list + one on
the inactive list. But reclaim_mapped may not always kick in
instantly, so it
could take even more than that.

Raise the threshold for marking a zone as all_unreclaimable from a
factor of 4
time the pages in the zone to 6. Introduce a mechanism to force
reclaim_mapped if we've reached a factor 3 and still haven't made progress.

Previously, a customer doing stress testing was able to easily OOM the box
after using only a small fraction of its swap (~100MB). After the
patches, it
would only OOM after having used up all swap (~800MB).

>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@xxxxxxxxxx ÂFor more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>
>
>



--
Regards
dave
--
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/