Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754084AbbFOI1e (ORCPT ); Mon, 15 Jun 2015 04:27:34 -0400 Received: from cantor2.suse.de ([195.135.220.15]:59285 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751515AbbFOI10 (ORCPT ); Mon, 15 Jun 2015 04:27:26 -0400 Date: Mon, 15 Jun 2015 09:27:20 +0100 From: Mel Gorman To: Hillf Danton Cc: linux-mm@kvack.org, linux-kernel , Rik van Riel , Johannes Weiner , Michal Hocko Subject: Re: [PATCH 07/25] mm, vmscan: Make kswapd think of reclaim in terms of nodes Message-ID: <20150615082720.GM26425@suse.de> References: <00ea01d0a4de$19f165d0$4dd43170$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <00ea01d0a4de$19f165d0$4dd43170$@alibaba-inc.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1552 Lines: 45 On Fri, Jun 12, 2015 at 03:05:00PM +0800, Hillf Danton wrote: > > - /* Reclaim above the high watermark. */ > > - sc->nr_to_reclaim = max(SWAP_CLUSTER_MAX, high_wmark_pages(zone)); > > + /* Aim to reclaim above all the zone high watermarks */ > > + for (z = 0; z <= end_zone; z++) { > > + zone = pgdat->node_zones + end_zone; > s/end_zone/z/ ? Ouch, thanks! With this bug, kswapd would reclaim based on a multiple of the highest zone. Whether that was under or over reclaim would depend on the size of that zone relative to lower zones. > > + nr_to_reclaim += high_wmark_pages(zone); > > > [...] > > @@ -3280,13 +3177,26 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order, > > compact_pgdat(pgdat, order); > > > > /* > > + * Stop reclaiming if any eligible zone is balanced and clear > > + * node writeback or congested. > > + */ > > + for (i = 0; i <= *classzone_idx; i++) { > > + zone = pgdat->node_zones + i; > > + > > + if (zone_balanced(zone, sc.order, 0, *classzone_idx)) { > > + clear_bit(PGDAT_CONGESTED, &pgdat->flags); > > + clear_bit(PGDAT_DIRTY, &pgdat->flags); > > + break; > s/break/goto out/ ? Yes. It'd actually be ok because it'll detect the same condition and exit in the next outer loop but goto out is better. -- Mel Gorman SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/