From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753485Ab0ILQU6 (ORCPT ); Sun, 12 Sep 2010 12:20:58 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:50147 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752403Ab0ILQU5 convert rfc822-to-8bit (ORCPT ); Sun, 12 Sep 2010 12:20:57 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=SWKJir4WtlQO25yyPNHmlVh/vVqI6R+D66ibX0S/gTQ9KwXKxDm5USCrrsDX08XdVS rA59bYNKKP7zR1VKNxa6NBiVm0Q48RHMhU+6cOrHXeF5coSXvq7AyVWGZeBu2KQTe2fD HQF5h59D9DU+Lq4+R/C+/ntL3KPF8nfJCoVmw= MIME-Version: 1.0 In-Reply-To: References: <1283697637-3117-1-git-send-email-minchan.kim@gmail.com> <20100908054831.GB20955@cmpxchg.org> <20100908154527.GA5936@barrios-desktop> <20100908151929.2586ace5.akpm@linux-foundation.org> Date: Mon, 13 Sep 2010 01:20:56 +0900 Message-ID: Subject: Re: [PATCH] vmscan: check all_unreclaimable in direct reclaim path From: Minchan Kim To: Dave Young Cc: Andrew Morton , Johannes Weiner , linux-mm , LKML , KOSAKI Motohiro , Rik van Riel , "Rafael J. Wysocki" , "M. Vefa Bicakci" , stable@kernel.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks, Dave. On Fri, Sep 10, 2010 at 5:24 PM, Dave Young wrote: > On Thu, Sep 9, 2010 at 6:19 AM, Andrew Morton wrote: >> On Thu, 9 Sep 2010 00:45:27 +0900 >> Minchan Kim 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 > 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@kvack.org.  For more info on Linux MM, >> see: http://www.linux-mm.org/ . >> Don't email: email@kvack.org >> >> > > > > -- > Regards > dave > -- Kind regards, Minchan Kim From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail202.messagelabs.com (mail202.messagelabs.com [216.82.254.227]) by kanga.kvack.org (Postfix) with SMTP id BAFAA6B00B2 for ; Sun, 12 Sep 2010 12:20:57 -0400 (EDT) Received: by mail-iw0-f169.google.com with SMTP id 33so5526979iwn.14 for ; Sun, 12 Sep 2010 09:20:56 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1283697637-3117-1-git-send-email-minchan.kim@gmail.com> <20100908054831.GB20955@cmpxchg.org> <20100908154527.GA5936@barrios-desktop> <20100908151929.2586ace5.akpm@linux-foundation.org> Date: Mon, 13 Sep 2010 01:20:56 +0900 Message-ID: Subject: Re: [PATCH] vmscan: check all_unreclaimable in direct reclaim path From: Minchan Kim Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sender: owner-linux-mm@kvack.org To: Dave Young Cc: Andrew Morton , Johannes Weiner , linux-mm , LKML , KOSAKI Motohiro , Rik van Riel , "Rafael J. Wysocki" , "M. Vefa Bicakci" , stable@kernel.org List-ID: Thanks, Dave. On Fri, Sep 10, 2010 at 5:24 PM, Dave Young wro= te: > On Thu, Sep 9, 2010 at 6:19 AM, Andrew Morton = wrote: >> On Thu, 9 Sep 2010 00:45:27 +0900 >> Minchan Kim wrote: >> >>> +static inline bool zone_reclaimable(struct zone *zone) >>> +{ >>> + =A0 =A0 return zone->pages_scanned < zone_reclaimable_pages(zone) * 6= ; >>> +} >>> + >>> +static inline bool all_unreclaimable(struct zonelist *zonelist, >>> + =A0 =A0 =A0 =A0 =A0 =A0 struct scan_control *sc) >>> +{ >>> + =A0 =A0 struct zoneref *z; >>> + =A0 =A0 struct zone *zone; >>> + =A0 =A0 bool all_unreclaimable =3D true; >>> + >>> + =A0 =A0 if (!scanning_global_lru(sc)) >>> + =A0 =A0 =A0 =A0 =A0 =A0 return false; >>> + >>> + =A0 =A0 for_each_zone_zonelist_nodemask(zone, z, zonelist, >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 gfp_zone(sc->gfp_mask), sc->n= odemask) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 if (!populated_zone(zone)) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 continue; >>> + =A0 =A0 =A0 =A0 =A0 =A0 if (!cpuset_zone_allowed_hardwall(zone, GFP_K= ERNEL)) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 continue; >>> + =A0 =A0 =A0 =A0 =A0 =A0 if (zone_reclaimable(zone)) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 all_unreclaimable =3D false; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; >>> + =A0 =A0 =A0 =A0 =A0 =A0 } >>> + =A0 =A0 } >>> + >>> =A0 =A0 =A0 return all_unreclaimable; >>> =A0} >> >> Could we have some comments over these functions please? =A0Why they >> exist, what problem they solve, how they solve them, etc. =A0Stuff which >> will be needed for maintaining this code three years from now. >> >> We may as well remove the `inline's too. =A0gcc will tkae care of that. >> >>> - =A0 =A0 =A0 =A0 =A0 =A0 if (nr_slab =3D=3D 0 && >>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0zone->pages_scanned >=3D (zone_reclaim= able_pages(zone) * 6)) >>> + =A0 =A0 =A0 =A0 =A0 =A0 if (nr_slab =3D=3D 0 && !zone_reclaimable(zon= e)) >> >> Extra marks for working out and documenting how we decided on the value >> of "6". =A0Sigh. =A0It's hopefully in the git record somewhere. > > Here it is (necessary to add additional comment?): > > commit 4ff1ffb4870b007b86f21e5f27eeb11498c4c077 > Author: Nick Piggin > Date: =A0 Mon Sep 25 23:31:28 2006 -0700 > > =A0 =A0[PATCH] oom: reclaim_mapped on oom > > =A0 =A0Potentially it takes several scans of the lru lists before we can = even start > =A0 =A0reclaiming pages. > > =A0 =A0mapped pages, with young ptes can take 2 passes on the active list= + one on > =A0 =A0the inactive list. =A0But reclaim_mapped may not always kick in > instantly, so it > =A0 =A0could take even more than that. > > =A0 =A0Raise the threshold for marking a zone as all_unreclaimable from a > factor of 4 > =A0 =A0time the pages in the zone to 6. =A0Introduce a mechanism to force > =A0 =A0reclaim_mapped if we've reached a factor 3 and still haven't made = progress. > > =A0 =A0Previously, a customer doing stress testing was able to easily OOM= the box > =A0 =A0after using only a small fraction of its swap (~100MB). =A0After t= he > patches, it > =A0 =A0would only OOM after having used up all swap (~800MB). > >> >> -- >> To unsubscribe, send a message with 'unsubscribe linux-mm' in >> the body to majordomo@kvack.org. =A0For more info on Linux MM, >> see: http://www.linux-mm.org/ . >> Don't email: email@kvack.org >> >> > > > > -- > Regards > dave > --=20 Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org