From patchwork Sun Mar 27 02:41:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 12792701 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 BDD16C433F5 for ; Sun, 27 Mar 2022 02:41:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C4D7A8D0002; Sat, 26 Mar 2022 22:41:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BFBB58D0001; Sat, 26 Mar 2022 22:41:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ACBFC8D0002; Sat, 26 Mar 2022 22:41:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 9C27D8D0001 for ; Sat, 26 Mar 2022 22:41:30 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 64BB85DF for ; Sun, 27 Mar 2022 02:41:30 +0000 (UTC) X-FDA: 79288615140.11.6FF235C Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by imf02.hostedemail.com (Postfix) with ESMTP id E2C948002E for ; Sun, 27 Mar 2022 02:41:29 +0000 (UTC) Received: by mail-ej1-f52.google.com with SMTP id pv16so22346535ejb.0 for ; Sat, 26 Mar 2022 19:41:29 -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=Lp7OyzRBJpk9Yhtc35RHQ3SBsAFn1AOoGl5hsCUQLbs=; b=MAfmrOrSIP7drRaxTKwnegVd2sfztTnVTorPJK7e8aedVf6yMq/vRH817+4junb0ix ww+vG67sokwSMY5RVO6HhUib64/0sQ2XS5JucHsX31m/OR9NLqUTm9p+n6V11nImiTX3 Z6HtXyyaaSK/XZDBfV6wnTdmzYzovYALAQZGw3clsmYjWZX168IuxaKjggXyvjp9G2Px cM/1T2ZQiLgW6HDPX95O0zS7ODao/evQK+pSDRxmDrqpOpGkIKEc17SMD8p9XLvUpB88 eM8cWlmXHL4+vvCZrLiMp64LTm4si3S0fe3GkN83AQ0V8uFCGK0eAWNcgrM0fMB3WjWU yu2w== 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=Lp7OyzRBJpk9Yhtc35RHQ3SBsAFn1AOoGl5hsCUQLbs=; b=BpQTWHn6cwvxvsNSKTQoA+rN1HTi6dBp3qOEujRkEj2Fo+yt0Gt7cPhRjjbyunJuLj aFaVt/4IUHJBOxfmdROKzNe1mqxgkcmXkMfBv5ejbg+HVzcmnI/qCgwX8i9U/ZcS+4Kt iVpMETP4nS9HQvn6g7DS46wiQjvcVb9GfVDwfVGbD4zBSZ5N4I3s00ihxdHTcivhIbsJ GFBBSBV7pRRgB/jufI/oK4h45RP6MJ0/6eV6gLJZ4oO1JN6nvTs15P+b/3zUPbDYeN9M R6B9pVkoBGJcAQuJMcyvZP4SMJ1ibjsqh8phMRh7NLEdl98uodRaN/Azaf16OmDTHvub 7elw== X-Gm-Message-State: AOAM532TkSXJ3Ysm1G4NHfLO6NZwUA5o29pLU9Yz4nAOh2HTyjReEgYN KAejoeg02XP6QP+v91UanA0= X-Google-Smtp-Source: ABdhPJwff1yCMKXeTrXkMama+S8HcSKS9lgO5aoriPadtVF0OJUe0QGsnM0vV+XByfwOXQGdiWM8OA== X-Received: by 2002:a17:907:eab:b0:6da:8ec5:d386 with SMTP id ho43-20020a1709070eab00b006da8ec5d386mr19851733ejc.668.1648348888564; Sat, 26 Mar 2022 19:41:28 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id sd7-20020a1709076e0700b006e015549bdfsm3982750ejc.53.2022.03.26.19.41.28 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 26 Mar 2022 19:41:28 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, ying.huang@intel.com, mgorman@techsingularity.net, Wei Yang Subject: [PATCH 1/2] mm/vmscan: reclaim only affects managed_zones Date: Sun, 27 Mar 2022 02:41:00 +0000 Message-Id: <20220327024101.10378-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 X-Stat-Signature: fqrwtpk1xfce7syred33sawdumhjatc7 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=MAfmrOrS; spf=pass (imf02.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.52 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: E2C948002E X-HE-Tag: 1648348889-732325 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As mentioned in commit 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with pages managed by the buddy allocator") , reclaim only affects managed_zones. Let's adjust the code and comment accordingly. Signed-off-by: Wei Yang Reviewed-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Oscar Salvador --- mm/vmscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 7ad54b770bb1..89745cf34386 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1031,7 +1031,7 @@ static bool skip_throttle_noprogress(pg_data_t *pgdat) for (i = 0; i < MAX_NR_ZONES; i++) { struct zone *zone = pgdat->node_zones + i; - if (!populated_zone(zone)) + if (!managed_zone(zone)) continue; reclaimable += zone_reclaimable_pages(zone); @@ -3912,7 +3912,7 @@ static bool pgdat_balanced(pg_data_t *pgdat, int order, int highest_zoneidx) } /* - * If a node has no populated zone within highest_zoneidx, it does not + * If a node has no managed zone within highest_zoneidx, it does not * need balancing by definition. This can happen if a zone-restricted * allocation tries to wake a remote kswapd. */ From patchwork Sun Mar 27 02:41:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 12792702 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 0F5C2C433EF for ; Sun, 27 Mar 2022 02:41:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4D27F8D0003; Sat, 26 Mar 2022 22:41:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A8258D0001; Sat, 26 Mar 2022 22:41:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BD4B8D0003; Sat, 26 Mar 2022 22:41:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id 2ED518D0001 for ; Sat, 26 Mar 2022 22:41:31 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D553F182895AE for ; Sun, 27 Mar 2022 02:41:30 +0000 (UTC) X-FDA: 79288615140.23.A9EB308 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by imf05.hostedemail.com (Postfix) with ESMTP id 776C1100032 for ; Sun, 27 Mar 2022 02:41:30 +0000 (UTC) Received: by mail-ej1-f52.google.com with SMTP id p15so22277885ejc.7 for ; Sat, 26 Mar 2022 19:41:30 -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:in-reply-to:references; bh=K3hLkpz9UBfsQM5/ihZSTbzc6DyuMMrFt7IBwlsxIaQ=; b=l/9VF2WnGPk2fqAXyOzFFMON51TfN9Ii8cqphdun+m3/apB1ILZLD4YyoVTfA4Qu1y n4IU7t+eAhKTUuLdW0tO82BjHcve71O+ULNWWdyjXrU5rfpJ8vbPzRzXX2GOFuBiAUNk a6nL+9jlbcrAXEOQzzSRCJur2fM9LPVMmySRzstCpXWqPe0LhCsIG+PlYE6mA2bwkAjL lbyWrEOZexk4SCXBHyQvRUUwuMSunSWnT6fbuy9Ac+PomRsq9mIkj1mlhE9m2EGeEkEf /qrKYKhsVhL6FErLQ9YWVytl7FpuwUqLSfCuz+8qZKQBFR+Tg88RKTwvu/p6ZNZflsVK G3hA== 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:in-reply-to :references; bh=K3hLkpz9UBfsQM5/ihZSTbzc6DyuMMrFt7IBwlsxIaQ=; b=KYkVxOmbvEc5xXxgMTcO884LbWITVC17N6/ilYZk4odNV1qKbtpxysGyTbrb0ilVl7 fgjUrNfEMkCb8T8DHtxdyk7Z30zzAUygGj46Hp+cwprdNGiMFAWrd9P5pASHudTtHr9Z eBzUOC4KHbMg4pdy8wtrehgi4yhIMis/A4uyvRmFQrc5hL7fEl7FT+pbmeloW5fvjWYH tOyP/0j5sEZzPv3lfcDlWAj31e8grQhN5TqcFjmctB7bjIipeKFogWw9bCXVYtGwF9+s iMQ9cEJgUH/EIWkN0/EePj35OGoAj7ou/0+mytO7pZue/6Ee0yPMWeyzA5ORYlgfTtan so8g== X-Gm-Message-State: AOAM5301djCbjy/yED2wTnP7zQ0xvvMqOqPk039frNYM4OBvZ5jM2XrT /fcPpbNWBM8LyC5Rpb5K8yg= X-Google-Smtp-Source: ABdhPJx+fb1QIhq3fxPuRrBmS1BZKFF09QsAxuxVkvXEYintX0IP/uzyplJG/MzAnP+6c8677PAsuA== X-Received: by 2002:a17:906:36ce:b0:6d6:e540:ed65 with SMTP id b14-20020a17090636ce00b006d6e540ed65mr19880051ejc.330.1648348889343; Sat, 26 Mar 2022 19:41:29 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id sb15-20020a1709076d8f00b006dfe4cda58fsm4128613ejc.95.2022.03.26.19.41.28 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 26 Mar 2022 19:41:29 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, ying.huang@intel.com, mgorman@techsingularity.net, Wei Yang Subject: [PATCH 2/2] mm/vmscan: make sure wakeup_kswapd with managed zone Date: Sun, 27 Mar 2022 02:41:01 +0000 Message-Id: <20220327024101.10378-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220327024101.10378-1-richard.weiyang@gmail.com> References: <20220327024101.10378-1-richard.weiyang@gmail.com> X-Stat-Signature: 4a1p3c9eti4fyeeq6f9on6ryweba9d3m Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="l/9VF2Wn"; spf=pass (imf05.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.52 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 776C1100032 X-HE-Tag: 1648348890-648693 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: wakeup_kswapd() only wake up kswapd when the zone is managed. For two callers of wakeup_kswapd(), they are node perspective. * wake_all_kswapds * numamigrate_isolate_page If we picked up a !managed zone, this is not we expected. This patch makes sure we pick up a managed zone for wakeup_kswapd(). Signed-off-by: Wei Yang Signed-off-by: Wei Yang --- mm/migrate.c | 2 +- mm/page_alloc.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index 3d60823afd2d..c4b654c0bdf0 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2046,7 +2046,7 @@ static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page) if (!(sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING)) return 0; for (z = pgdat->nr_zones - 1; z >= 0; z--) { - if (populated_zone(pgdat->node_zones + z)) + if (managed_zone(pgdat->node_zones + z)) break; } wakeup_kswapd(pgdat->node_zones + z, 0, order, ZONE_MOVABLE); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 4c0c4ef94ba0..6656c2d06e01 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4674,6 +4674,8 @@ static void wake_all_kswapds(unsigned int order, gfp_t gfp_mask, for_each_zone_zonelist_nodemask(zone, z, ac->zonelist, highest_zoneidx, ac->nodemask) { + if (!managed_zone(zone)) + continue; if (last_pgdat != zone->zone_pgdat) wakeup_kswapd(zone, gfp_mask, order, highest_zoneidx); last_pgdat = zone->zone_pgdat;