From patchwork Tue Sep 28 12:23:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liangcai Fan X-Patchwork-Id: 12522423 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D562C433EF for ; Tue, 28 Sep 2021 12:23:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2A92F6101E for ; Tue, 28 Sep 2021 12:23:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2A92F6101E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id A5BBB900003; Tue, 28 Sep 2021 08:23:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A0B69900002; Tue, 28 Sep 2021 08:23:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8FA8F900003; Tue, 28 Sep 2021 08:23:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id 83507900002 for ; Tue, 28 Sep 2021 08:23:46 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2B12A8249980 for ; Tue, 28 Sep 2021 12:23:46 +0000 (UTC) X-FDA: 78636898452.12.3F6026A Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf04.hostedemail.com (Postfix) with ESMTP id E238350000B2 for ; Tue, 28 Sep 2021 12:23:45 +0000 (UTC) Received: by mail-pl1-f179.google.com with SMTP id t4so14129781plo.0 for ; Tue, 28 Sep 2021 05:23:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=4GeZ/5gk5iC0Am0p5VWsBHcc/TF1iKy05S6f2LF/3lk=; b=Qi70LZqc9eZo81OU15I3zbLToEhnqCU/ZzYn3ocgSkEtpAd2KZ0FcM021XOaiwbMxE jr/hWM/DvkdOD6K3lDfxi4s3NbomrFybjalsq0aMwSPa1NVUKofO4Hwunp9samcjguqt VK9KudzoqITsQTZ1FhxEMC6FhjOKd5eL0dd2eChuYLXtWwl4kT7KrKwgdyjlmgHidi4N 9CQL7MFsmGVkLnHRAqfUO2g57iCZlZlvSnVBoCFUwdXBSov85VK+i6DbUipPbY/ybPX8 XyHQxef7c03no+HSUTweOPg/5Mr0IL5Bm++hc0LzRcrEUAlzTO7l9CArhsyaJ1c4wOzr OXmg== 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; bh=4GeZ/5gk5iC0Am0p5VWsBHcc/TF1iKy05S6f2LF/3lk=; b=Jk4H/kBph+B8ElqtFVUFS0HXJEs++jTgTXBMvkkMCprohXOScoap1NIdVnmXMo2fW+ XhOBH03aYLMSDyiHbZS1CA9eTbkmqplQrxPIFBobpQCMti/rzwPzxVDjXJMFU/MXtXRy bR59H/yC9uIIixkTdrwQCADqzou/3dhkVKlJu3Lvbw6pkUISWl1pJrZ6LC0Jp5DG0yvq Sj28bGHIXYz4xinUgo8oVP8eaI5xHn04jeN6NxxHm3zLtDXtKVJPc7ziIxo2drohqiYm Tf7l5vh+31PAtYHiDBYq79NmAKGGA3vUryI0Agp20z/Rk81cVu2S4K2kqFEkDcnJPAcf aUlg== X-Gm-Message-State: AOAM531jJAEL/r2pMNTUZLhWiHCNK1QUbPZrkyfWY5y9Ks9izQKVNXJ2 YA7iD74iMMva+l9ZGdMX8o8= X-Google-Smtp-Source: ABdhPJzS5wspBeT9oC9SmWiBIy1yKl+3CWyU7OrYZkOXgu6I7R88L8eFhORPmuw24fJDQhTS6VzHdg== X-Received: by 2002:a17:90a:ce02:: with SMTP id f2mr5169225pju.231.1632831824876; Tue, 28 Sep 2021 05:23:44 -0700 (PDT) Received: from bj10083pcu01.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id z85sm8874518pfc.162.2021.09.28.05.23.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Sep 2021 05:23:44 -0700 (PDT) From: Liangcai Fan To: liangcai.fan@unisoc.com, akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, zhang.lyra@gmail.com, Liangcai Fan Subject: [PATCH] mm: Set min_free_kbytes with user_min_free_kbytes when user_min_free_kbytes is preferred Date: Tue, 28 Sep 2021 20:23:17 +0800 Message-Id: <1632831797-32192-1-git-send-email-liangcaifan19@gmail.com> X-Mailer: git-send-email 1.9.1 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: E238350000B2 X-Stat-Signature: 8iw57yucdoiq7a51yyjy7neffg116jm6 Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Qi70LZqc; spf=pass (imf04.hostedemail.com: domain of liangcaifan19@gmail.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=liangcaifan19@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1632831825-752911 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: The 'min_free_kbytes' and 'user_min_free_kbytes' maybe inconsistent after a few times of memory hotplug. When 'new_min_free_kbytes' is not larger than 'user_min_free_kbytes', set 'min_free_kbytes' with 'user_min_free_kbytes' rather than leave it as the 'new_min_free_kbytes' calculated for the last time. Signed-off-by: Liangcai Fan Cc: Chunyan Zhang --- mm/page_alloc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b37435c..ddf9dc1 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -8467,6 +8467,12 @@ int __meminit init_per_zone_wmark_min(void) if (min_free_kbytes > 262144) min_free_kbytes = 262144; } else { + /* + * Set 'min_free_kbytes' with 'user_min_free_kbytes' rather than + * leave it as the 'new_min_free_kbytes' calculated for the last + * time. + */ + min_free_kbytes = user_min_free_kbytes; pr_warn("min_free_kbytes is not updated to %d because user defined value %d is preferred\n", new_min_free_kbytes, user_min_free_kbytes); }