Re: [PATCH v3 -mm 1/3] mm: reclaim at order 0 when compaction is enabled

From: Hillf Danton
Date: Fri Jan 27 2012 - 04:13:27 EST


Hi Rik

On Fri, Jan 27, 2012 at 3:59 AM, Rik van Riel <riel@xxxxxxxxxx> wrote:
> When built with CONFIG_COMPACTION, kswapd should not try to free
> contiguous pages, because it is not trying hard enough to have
> a real chance at being successful, but still disrupts the LRU
> enough to break other things.
>
> Do not do higher order page isolation unless we really are in
> lumpy reclaim mode.
>
> Stop reclaiming pages once we have enough free pages that
> compaction can deal with things, and we hit the normal order 0
> watermarks used by kswapd.
>
> Also remove a line of code that increments balanced right before
> exiting the function.
>
> Signed-off-by: Rik van Riel <riel@xxxxxxxxxx>
> ---
> -v4: further cleanups suggested by Mel Gorman
> Âmm/vmscan.c | Â 43 +++++++++++++++++++++++++++++--------------
> Â1 files changed, 29 insertions(+), 14 deletions(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 2880396..2e2e43d 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1139,7 +1139,7 @@ int __isolate_lru_page(struct page *page, isolate_mode_t mode, int file)
> Â* @mz: Â Â Â Â Â Â Â ÂThe mem_cgroup_zone to pull pages from.
> Â* @dst: Â Â Â The temp list to put pages on to.
> Â* @nr_scanned: Â Â Â ÂThe number of pages that were scanned.
> - * @order: Â Â The caller's attempted allocation order
> + * @sc: Â Â Â Â Â Â Â ÂThe scan_control struct for this reclaim session
> Â* @mode: Â Â ÂOne of the LRU isolation modes
> Â* @active: Â ÂTrue [1] if isolating active pages
> Â* @file: Â Â ÂTrue [1] if isolating file [!anon] pages
> @@ -1148,8 +1148,8 @@ int __isolate_lru_page(struct page *page, isolate_mode_t mode, int file)
> Â*/
> Âstatic unsigned long isolate_lru_pages(unsigned long nr_to_scan,
> Â Â Â Â Â Â Â Âstruct mem_cgroup_zone *mz, struct list_head *dst,
> - Â Â Â Â Â Â Â unsigned long *nr_scanned, int order, isolate_mode_t mode,
> - Â Â Â Â Â Â Â int active, int file)
> + Â Â Â Â Â Â Â unsigned long *nr_scanned, struct scan_control *sc,
> + Â Â Â Â Â Â Â isolate_mode_t mode, int active, int file)
> Â{
> Â Â Â Âstruct lruvec *lruvec;
> Â Â Â Âstruct list_head *src;
> @@ -1195,7 +1195,7 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
> Â Â Â Â Â Â Â Â Â Â Â ÂBUG();
> Â Â Â Â Â Â Â Â}
>
> - Â Â Â Â Â Â Â if (!order)
> + Â Â Â Â Â Â Â if (!sc->order || !(sc->reclaim_mode & RECLAIM_MODE_LUMPYRECLAIM))
> Â Â Â Â Â Â Â Â Â Â Â Âcontinue;
>
Just a tiny advice 8-)

mind to move checking lumpy reclaim out of the loop,
something like

unsigned long nr_lumpy_failed = 0;
unsigned long scan;
int lru = LRU_BASE;
+ int order = sc->order;
+
+ if (!(sc->reclaim_mode & RECLAIM_MODE_LUMPYRECLAIM))
+ order = 0;

lruvec = mem_cgroup_zone_lruvec(mz->zone, mz->mem_cgroup);
if (active)
lru += LRU_ACTIVE;

with a line of comment?

Hillf
--
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/