From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751462AbcFXJAU (ORCPT ); Fri, 24 Jun 2016 05:00:20 -0400 Received: from out4133-114.mail.aliyun.com ([42.120.133.114]:13481 "EHLO out4133-114.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751232AbcFXJAS (ORCPT ); Fri, 24 Jun 2016 05:00:18 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R271e4;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e02c03299;MF=hillf.zj@alibaba-inc.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_----4xdhzXK_1466758795; Reply-To: "Hillf Danton" From: "Hillf Danton" To: "'Mel Gorman'" Cc: "'Johannes Weiner'" , "'Vlastimil Babka'" , "'linux-kernel'" , , "Andrew Morton" Subject: [PATCH] mm, vmscan: Make kswapd reclaim no more than needed Date: Fri, 24 Jun 2016 16:59:55 +0800 Message-ID: <082f01d1cdf6$c789a2b0$569ce810$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AdHN9ab9aGTqwMAoRLODoWpAumXX8Q== Content-Language: zh-cn Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We stop reclaiming pages if any eligible zone is balanced. Signed-off-by: Hillf Danton --- --- a/mm/vmscan.c Thu Jun 23 17:56:34 2016 +++ b/mm/vmscan.c Fri Jun 24 16:45:58 2016 @@ -3185,15 +3185,10 @@ static int balance_pgdat(pg_data_t *pgda if (!populated_zone(zone)) continue; - if (!zone_balanced(zone, sc.order, classzone_idx)) { - classzone_idx = i; - break; - } + if (zone_balanced(zone, sc.order, classzone_idx)) + goto out; } - if (i < 0) - goto out; - /* * Do some background aging of the anon list, to give * pages a chance to be referenced before reclaiming. All @@ -3236,19 +3231,6 @@ static int balance_pgdat(pg_data_t *pgda /* Check if kswapd should be suspending */ if (try_to_freeze() || kthread_should_stop()) break; - - /* - * 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 (!populated_zone(zone)) - continue; - - if (zone_balanced(zone, sc.order, classzone_idx)) - goto out; - } /* * Raise priority if scanning rate is too low or there was no --