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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B31C2C433F5 for ; Sun, 2 Jan 2022 03:31:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF2AD6B0071; Sat, 1 Jan 2022 22:31:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AA1286B0073; Sat, 1 Jan 2022 22:31:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 969FB6B0074; Sat, 1 Jan 2022 22:31:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0089.hostedemail.com [216.40.44.89]) by kanga.kvack.org (Postfix) with ESMTP id 86AB96B0071 for ; Sat, 1 Jan 2022 22:31:49 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2BC028DF92 for ; Sun, 2 Jan 2022 03:31:49 +0000 (UTC) X-FDA: 78983922738.12.E157C54 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf18.hostedemail.com (Postfix) with ESMTP id 4B74C1C000A for ; Sun, 2 Jan 2022 03:31:38 +0000 (UTC) Received: by mail-pf1-f177.google.com with SMTP id 8so26755780pfo.4 for ; Sat, 01 Jan 2022 19:31:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6mGMDwMYzsbtIAV8Ge2UR4U7kb+kupKdQiyzOY6W9VM=; b=bteVmKTz4doQHMEkurGnEVIsTfSON/5wwzIWctdq7DwpMLDx5ZcahQRoT7iu6dHViF D3PYMLI1ycKTLX/kMAf/S+0uohdXXHOP0E6A+sHswhSjbugeZU4TlTBPiMaQ0LH0z2aw RAJSkGDnU6S+oILWhi4apYgEyWmiMxX7h2NnIfOTimYDXuI8HFam7RHMv6vnkFNqkqza 4TEYVSTvOHscozRlBRWeWAnR7konv44dht2mXooULiCpLwN/eSzOs+aFdY71JnqMgzZj 45jAYm7PD509mBv2dCaIs+WtXFgnEYn3P8r7ORCsGvrJjncSlWk7S5ItZKlXV2LNGS6G X59A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6mGMDwMYzsbtIAV8Ge2UR4U7kb+kupKdQiyzOY6W9VM=; b=UbVQ5ohE5XLEmyhLdx1Pml1nq9XJaLUzzbXInhYsbDmZZoOSgz5ap4BkUpSO2QlPoM jLY3fAdxkgvqRhhlkmZiekG5Ei8FX1apMn4ksEhye3PQ5eMrKOj0l+w53H3jdTiIKVYb EKSo+eooTJXTgRhxcBgtLceNTcZBjyBZGxTmHQkR41xKwGsa+s9/v0kkt1LnzLolENx0 jwEFsmEpR+C2j09h7vsEGcp5R2kUflugIL88Zx1k0M5J4WAhgfzXF3oNCeabPo4txlqh f+ElUnfCgP3Th61qbG3Vki+r28oJ3hRiFkXKRI723Zg7vR2fq73ZBk12CjuTuLvSHhkN QcHA== X-Gm-Message-State: AOAM531JBTWO0qE6I/6UeXRQWhKdVltQ1LwXLhcUROYM11ktHwR1XppY VSp6e7qJopkJMm4WR1fNhqI= X-Google-Smtp-Source: ABdhPJyL+Q9QfRnHES8SFspujjLe+fFcxRcTX4lc27QSYJvb5TJLzIJglnh0Q3HW6/TOTE+uJUnANA== X-Received: by 2002:a63:804a:: with SMTP id j71mr36099020pgd.72.1641094307633; Sat, 01 Jan 2022 19:31:47 -0800 (PST) Received: from localhost.localdomain ([211.193.61.222]) by smtp.gmail.com with ESMTPSA id on2sm37348649pjb.19.2022.01.01.19.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jan 2022 19:31:47 -0800 (PST) From: skseofh@gmail.com To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Daero Lee Subject: [PATCH] mm/vmscan.c: no need to double-check if free pages are under high-watermark Date: Sun, 2 Jan 2022 12:31:29 +0900 Message-Id: <20220102033129.12913-1-skseofh@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 4B74C1C000A X-Stat-Signature: rfairbwku5oc6xwhbuzp3b98zcj17q37 Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=bteVmKTz; spf=pass (imf18.hostedemail.com: domain of skseofh@gmail.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=skseofh@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1641094298-693202 Content-Transfer-Encoding: quoted-printable 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: From: Daero Lee In kswapd_try_to_sleep function, to check whether kswapd can sleep, the prepare_kswapd_sleep function is called twice. If free pages are below high-watermark in the first call, the @remaining variable is not updated at 0 and the prepare_kswapd_sleep function is called for the second time. I think it is necessary to set the initial value of the @remaining to a non-zero value to prevent consecutive calls to the same function. Signed-off-by: Daero Lee --- mm/vmscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 700434db5735..1217ecec5bbb 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4331,7 +4331,7 @@ static int balance_pgdat(pg_data_t *pgdat, int orde= r, int highest_zoneidx) /* * Return the order kswapd stopped reclaiming at as * prepare_kswapd_sleep() takes it into account. If another caller - * entered the allocator slow path while kswapd was awake, order will + * entered the allqocator slow path while kswapd was awake, order will * remain at the higher level. */ return sc.order; @@ -4355,7 +4355,7 @@ static enum zone_type kswapd_highest_zoneidx(pg_dat= a_t *pgdat, static void kswapd_try_to_sleep(pg_data_t *pgdat, int alloc_order, int r= eclaim_order, unsigned int highest_zoneidx) { - long remaining =3D 0; + long remaining =3D ~0; DEFINE_WAIT(wait); =20 if (freezing(current) || kthread_should_stop()) --=20 2.25.1