From patchwork Tue Mar 29 01:09: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: 12794358 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 6EF56C433F5 for ; Tue, 29 Mar 2022 01:09:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DCC578D0002; Mon, 28 Mar 2022 21:09:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D77CE8D0001; Mon, 28 Mar 2022 21:09:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C40BA8D0002; Mon, 28 Mar 2022 21:09:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0092.hostedemail.com [216.40.44.92]) by kanga.kvack.org (Postfix) with ESMTP id B850C8D0001 for ; Mon, 28 Mar 2022 21:09:20 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6E793A2AF5 for ; Tue, 29 Mar 2022 01:09:20 +0000 (UTC) X-FDA: 79295640480.24.EE714B2 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by imf14.hostedemail.com (Postfix) with ESMTP id E612B100004 for ; Tue, 29 Mar 2022 01:09:19 +0000 (UTC) Received: by mail-ed1-f52.google.com with SMTP id g20so18940878edw.6 for ; Mon, 28 Mar 2022 18:09:19 -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=weU7q/SN2SltRbJQURNE4PC1QrQjfwh5B+KAtHbIdnc=; b=k6iWONx0uz3YChLyoZl9HRU7H3syEfFSjM5BSJbE/VqJ8rKfOp0dFo3X4DJd8CKDHx 5zPYcIebYhftht2alU1mQV+pmSpyhwZHWJN6iYHHAjmKCkXMXpLOiQQXBiU/m0hHXWEm i5YKf5Qk/JcfcIqxh4VmRvf9SN+icp7poTb0JQjwgCNKk68HCC/m2eDvz0FgJ8G2L1PC 6FQxg9W/Buf5DTlOGN8pWas/ThshtLegH8vW8sI/r3ba5BDLUFlNQHpEFSYtJVBoJtFx NjClO7UZuNCB6D8/hyLpc3c3qqsBHCftaDG4A5ynGzhXTCV3BVOGfvYGYaMNjuGIIBg9 mq9Q== 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=weU7q/SN2SltRbJQURNE4PC1QrQjfwh5B+KAtHbIdnc=; b=2PmJY/7n9b7MVGJSHYJkvHYckIR3JweEGuiK4hktCt/+pUfe9sLc8GJCC3/ZH2Gd98 0scs8ONhCYAwKL6dDJLmfXj0E+vzUR7Nt/RW0sHy89SaNV+7uMLcH6D3roC+hiVWTeH0 g0cuQJdJVHvlq5BclL+GsFHkcEbcy1Cusog8IzlZUy9DyN8gjr+uynaU1QTJ6wtno8D5 VuBW4Oea/ocxIzks5RnlmQBJnA4dE8YnOgw0IPG28DiYB+C4vP6Oto/MtPCBO2IMLLQq rl0xz1rFH5Ihnyk8Mu96A1ut9HzYHInKgTDWB57A4FEFXhAjy1dJVHAPcMdaHCGmMFe/ wIXg== X-Gm-Message-State: AOAM533eRTxZLHrdkIeVfVZIv7D7p8cYO4boHI6+VRnjzXccZ6AHFe05 YFvUWI6seBXFsDqCzWLfUjI= X-Google-Smtp-Source: ABdhPJx6aXVqw3VlS7+v6A16JzK1+0VJCPyzirZLftLATSn9NxtHnWWnAEvTYiG1BeI8jkEztYgyHA== X-Received: by 2002:aa7:dbd6:0:b0:408:4a31:97a5 with SMTP id v22-20020aa7dbd6000000b004084a3197a5mr991335edt.186.1648516158666; Mon, 28 Mar 2022 18:09:18 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id u10-20020a50d94a000000b004131aa2525esm7896399edj.49.2022.03.28.18.09.18 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Mar 2022 18:09:18 -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 v2 1/2] mm/vmscan: reclaim only affects managed_zones Date: Tue, 29 Mar 2022 01:09:00 +0000 Message-Id: <20220329010901.1654-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=k6iWONx0; spf=pass (imf14.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.52 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: E612B100004 X-Stat-Signature: pi1cxzijiy83gqncy5o7udw3t3d4myg1 X-HE-Tag: 1648516159-434433 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: 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 Cc: "Huang, Ying" Cc: Mel Gorman Signed-off-by: Andrew Morton --- mm/vmscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 1f2d79e8c43c..4385b59ef599 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1040,7 +1040,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); @@ -3909,7 +3909,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 Tue Mar 29 01:09: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: 12794359 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 52410C433EF for ; Tue, 29 Mar 2022 01:09:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B5A668D0003; Mon, 28 Mar 2022 21:09:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A7E08D0001; Mon, 28 Mar 2022 21:09:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8475F8D0003; Mon, 28 Mar 2022 21:09:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0179.hostedemail.com [216.40.44.179]) by kanga.kvack.org (Postfix) with ESMTP id 767858D0001 for ; Mon, 28 Mar 2022 21:09:21 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 344E8A4A60 for ; Tue, 29 Mar 2022 01:09:21 +0000 (UTC) X-FDA: 79295640522.24.808878B Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by imf23.hostedemail.com (Postfix) with ESMTP id A6BE014000A for ; Tue, 29 Mar 2022 01:09:20 +0000 (UTC) Received: by mail-ej1-f52.google.com with SMTP id j15so32005128eje.9 for ; Mon, 28 Mar 2022 18:09:20 -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=mwCZhHA9nqulJbLohXXtbB61b1ZNqi8d7Xd2G1q8iKc=; b=jnmcvSVvJBI7Xd8CkSC4mOK4vi73UyKCWU3eJQ6hETgpgOYniguERwOCvr3yJ3cAiH 0QHtl1844SvAIdv2l1rYv5li7wKE8rwrFhs94N+3+/oii52AiVjejQ6fvaw+FnYvokcN UJc+9SpgtxryyqyRieLnz62woaz7s4fHsazvi2/G0oi8IbcOHilJXjWkHfyPtm3PE1DI orsJt0h29n0hBCwYRFHhR6SeFZ1e8aT14f4TqfXhFav8iqRxrgdrcQnfDao35sMgB/ae uZ9EKPg5eBTUCJI6djNwb4vat6zj5Ycul0RiS4YWRCl9ZMa62pj0205vmFF1UWQ9skFB xIaw== 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=mwCZhHA9nqulJbLohXXtbB61b1ZNqi8d7Xd2G1q8iKc=; b=0OaXAn1riDUA1hX7wxLRU3SIvCZcSuP9mHL117IVpVfaaRCGYT0Xw1vAG5sMWlqkuL GdwFTiPM4MFldI/yDZ1Y1sUEmoJ11ihyoBSPvV1T388WZXkyiWA+HL6WsYH27T4ufcZD pq2bksVgQE5S7+yAX2+8JyuiExd17ukxTO5t1PcvS1XTXU2DJe8ELPMd7HQavB9eHYXu cbl9OfYr0kVGbpWN4+8HXW6Q+29iMQbyIdsx1EvTTXSXoxJMWGKS4U0K+u/e+WNF0eOJ b9pS+OgIPRVHYjX5EUntaEViqKfiwsbcRa8S/g/NBcGHpz00IRvbJcgXPR5Q+R/SfdFF Wq4g== X-Gm-Message-State: AOAM531W8uGKsTicCYzDKLNMWTnmfvbke2x2ylVIhMrxp90iidl8ilBg NktQ2gcIhDY015EUIGSeSco= X-Google-Smtp-Source: ABdhPJzjDkNeJ7oQwNTVr2E8XwOQIK9cknTawSzTrHLCYwivBWAiPt6/Y0U1hMfCkC+iWI79NXxBVA== X-Received: by 2002:a17:906:d554:b0:6df:a6f8:799a with SMTP id cr20-20020a170906d55400b006dfa6f8799amr31020900ejc.492.1648516159433; Mon, 28 Mar 2022 18:09:19 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id bo14-20020a170906d04e00b006ce98d9c3e3sm6387886ejb.194.2022.03.28.18.09.19 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Mar 2022 18:09:19 -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 , Miaohe Lin , David Hildenbrand , Oscar Salvador Subject: [Patch v2 2/2] mm/vmscan: make sure wakeup_kswapd with managed zone Date: Tue, 29 Mar 2022 01:09:01 +0000 Message-Id: <20220329010901.1654-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220329010901.1654-1-richard.weiyang@gmail.com> References: <20220329010901.1654-1-richard.weiyang@gmail.com> X-Stat-Signature: btgh4f459an7dws3rw3efnf9m6mzyug7 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A6BE014000A Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=jnmcvSVv; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.52 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com X-Rspam-User: X-HE-Tag: 1648516160-125840 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(). And it also use managed_zone in migrate_balanced_pgdat() to get the proper zone. Signed-off-by: Wei Yang Cc: Miaohe Lin Cc: David Hildenbrand Cc: "Huang, Ying" Cc: Mel Gorman Cc: Oscar Salvador Signed-off-by: Andrew Morton Reviewed-by: "Huang, Ying" Reviewed-by: Miaohe Lin Reviewed-by: David Hildenbrand --- v2: adjust the usage in migrate_balanced_pgdat() --- mm/migrate.c | 6 +++--- mm/page_alloc.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 3d60823afd2d..5adc55b5347c 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1971,7 +1971,7 @@ SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages, #ifdef CONFIG_NUMA_BALANCING /* * Returns true if this is a safe migration target node for misplaced NUMA - * pages. Currently it only checks the watermarks which crude + * pages. Currently it only checks the watermarks which is crude. */ static bool migrate_balanced_pgdat(struct pglist_data *pgdat, unsigned long nr_migrate_pages) @@ -1981,7 +1981,7 @@ static bool migrate_balanced_pgdat(struct pglist_data *pgdat, for (z = pgdat->nr_zones - 1; z >= 0; z--) { struct zone *zone = pgdat->node_zones + z; - if (!populated_zone(zone)) + if (!managed_zone(zone)) continue; /* Avoid waking kswapd by allocating pages_to_migrate pages. */ @@ -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;