From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DF4EC35250 for ; Sun, 9 Feb 2020 07:42:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C304A20733 for ; Sun, 9 Feb 2020 07:42:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C304A20733 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5AAB46B0007; Sun, 9 Feb 2020 02:42:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 55AF86B0008; Sun, 9 Feb 2020 02:42:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 46F556B000A; Sun, 9 Feb 2020 02:42:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0175.hostedemail.com [216.40.44.175]) by kanga.kvack.org (Postfix) with ESMTP id 2DAAB6B0007 for ; Sun, 9 Feb 2020 02:42:43 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id C3F7C281A for ; Sun, 9 Feb 2020 07:42:42 +0000 (UTC) X-FDA: 76469796564.04.fact64_1793ff65e223e X-HE-Tag: fact64_1793ff65e223e X-Filterd-Recvd-Size: 3188 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Sun, 9 Feb 2020 07:42:41 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Feb 2020 23:42:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,420,1574150400"; d="scan'208";a="225830659" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga008.jf.intel.com with ESMTP; 08 Feb 2020 23:42:37 -0800 From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, shakeelb@google.com, yang.shi@linux.alibaba.com, mgorman@techsingularity.net, Wei Yang Subject: [RFC Patch] mm/vmscan.c: not inherit classzone_idx from previous reclaim Date: Sun, 9 Feb 2020 15:41:45 +0800 Message-Id: <20200209074145.31389-1-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Before commit e716f2eb24de ("mm, vmscan: prevent kswapd sleeping prematurely due to mismatched classzone_idx"), classzone_idx could have two possibilities on a new loop based on whether there is a wakeup during reclaiming: * 0 if no wakeup * the classzone_idx request by wakeup As described in the changelog, this commit is willing to change the first case to (MAX_NR_ZONES - 1) to avoid some premature sleep. But it does not achieve the goal. There are two versions of kswapd_classzone_idx() since this change: * commit e716f2eb24de ("mm, vmscan: prevent kswapd sleeping prematurely due to mismatched classzone_idx") * commit dffcac2cb88e ("mm/vmscan.c: prevent useless kswapd loops") Both of them would return the classzone_idx we passed as the 2nd parameter when (pgdat->kswapd_classzone_idx == MAX_NR_ZONES). This means if there is no wakeup during reclaiming, we would use classzone_idx in previous round to sleep. This patch fixes the logic by using (MAX_NR_ZONES - 1) for the first case. Signed-off-by: Wei Yang --- mm/vmscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index e7b647f70407..ea2f0abef1d4 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3879,7 +3879,7 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int alloc_order, int reclaim_o static int kswapd(void *p) { unsigned int alloc_order, reclaim_order; - unsigned int classzone_idx = MAX_NR_ZONES - 1; + unsigned int classzone_idx; pg_data_t *pgdat = (pg_data_t*)p; struct task_struct *tsk = current; const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id); @@ -3908,7 +3908,7 @@ static int kswapd(void *p) bool ret; alloc_order = reclaim_order = pgdat->kswapd_order; - classzone_idx = kswapd_classzone_idx(pgdat, classzone_idx); + classzone_idx = kswapd_classzone_idx(pgdat, MAX_NR_ZONES - 1); kswapd_try_sleep: kswapd_try_to_sleep(pgdat, alloc_order, reclaim_order, -- 2.17.1