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 1C78EC27C53 for ; Tue, 4 Jun 2024 08:45:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 858ED6B0095; Tue, 4 Jun 2024 04:45:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8089D6B0096; Tue, 4 Jun 2024 04:45:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CFF06B0098; Tue, 4 Jun 2024 04:45:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 4F1DD6B0095 for ; Tue, 4 Jun 2024 04:45:46 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id DE96D120DFB for ; Tue, 4 Jun 2024 08:45:45 +0000 (UTC) X-FDA: 82192573050.18.3ADF65F Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by imf30.hostedemail.com (Postfix) with ESMTP id DFA4680008 for ; Tue, 4 Jun 2024 08:45:42 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717490743; a=rsa-sha256; cv=none; b=KlxfBD/GgIFUY/P4eido3JcKmq2NSJm4KjttlLempX1RBKSo487B0377/AcBqe9ckRQpaJ QL7/1nbX/xjqyyrRYkRXcBVSCp1rdgL02yjGlf1kdvGXabcyruXc4wnHXe/ydIPCkc6v9N q/Yg40G6vimbfk4LZsA6vHF0EWoenoA= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717490743; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3jLbIBdOSTItClSO3GxLRdLbrCJf46svV6LA6jG9cCI=; b=uKDR3ofW5dIz4s2AZwE2ToGIoDir2XNTDNOcMG+PLsMCs7OVG4xXYeMTIOaBWiLxpmyJ8x ZaPQeQoGJ5YMFxV+Q7vXAIkcZYS5K+cmrjRRsM5L1Tj1dslPeYGaQtQVNhAMxUCcUHI8Hr 66we6d5vYFNZxm1prAkocdXr0gK+4L4= X-AuditID: a67dfc5b-d85ff70000001748-9a-665ed43276cc Date: Tue, 4 Jun 2024 17:45:33 +0900 From: Byungchul Park To: "Huang, Ying" Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com, hannes@cmpxchg.org, iamjoonsoo.kim@lge.com, rientjes@google.com Subject: Re: [PATCH v2] mm: let kswapd work again for node that used to be hopeless but may not now Message-ID: <20240604084533.GA68919@system.software.com> References: <20240604072323.10886-1-byungchul@sk.com> <87bk4hcf7h.fsf@yhuang6-desk2.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87bk4hcf7h.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsXC9ZZnoa7Rlbg0g/ZzOhZz1q9hs1i9yddi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cYCYnAJ2EjuuWoFUiAooSxzYdpxpAiPvLCTNs5A0z0JoXsDIvIpRJDOvLDcxM8dUrzg7 ozIvs0IvOT93EyMwZJfV/pm4g/HLZfdDjAIcjEo8vBYrY9OEWBPLiitzDzFKcDArifD21UWn CfGmJFZWpRblxxeV5qQWH2KU5mBREuf1Ck9NEBJITyxJzU5NLUgtgskycXBKNTD2vS5dvWlx DFtc/h/Xr4v1nzjOXPM39h8bk8le7bcT24+sSJhaemtfkve3wF9u77dUFlzo8X/xJ+bfzIse j39tbWc8nPb39eaw+/HHF0+3PhHZ5LGy8uyiig5mX4dG95/VHtImYU13fh1I8/5ov/SBWtDt BEalJ29Z0iOWL9rEEff2zJpb05ZMVmIpzkg01GIuKk4EAL/tOjJVAgAA X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: DFA4680008 X-Rspam-User: X-Rspamd-Server: rspam12 X-Stat-Signature: i5c57mz4a9bgzr8wz46uzim7k1q4sp63 X-HE-Tag: 1717490742-660495 X-HE-Meta: U2FsdGVkX1+V1xFO2EbafPwYXDrcjaBt/X1S3553/cUSJ7RBBRuEx3ryqIxnZcCQznd5rAsni9EXC8WWTTW/ifphVrKcVWrfbab1hUSvvCpFzTlzXTND9pKGisAxzXlXmLMs6JbMmHLQTeYNQ/+aLttG8q71Fu7GXKrFCRV3QYYKIGCG3hGDzOpb1KUafXoE7C773wgdLLpTjnSSF3SvOEEGbjhMks6EJ3nb/K9xGUscCdReapYS4DlUxPlcGBfqV4K4KQlnQrxlDdIGLK3RogB88nCUkGC7HPfZ38lg8azJgwZeK95W+1wQdEK/EtMpZAwUBZrcn8qToFmnk/A3ykcMTxGe3kRi9h/wOr0Wst1Ucu4ZFseN30R1uiiBZFh18hjVqri3C9Y8LLtg7BppNFVafSxN5v97d47dPrDFOZON92B1K1APiAoVKswVehUj1npZCR+vuqNcLliX7xJDuhuz3FToBQIdqLZ98r0vr8JmTxQdr7pw2LGCGbBDeSUOO+oSOOc9xbDe1C74CBiA+8ynFB5whFdZ8p4riwCHgujS/efwi2zoAGJRo60+I8JwU0t3ge9BCZY6g2HaYqmO2cOGZhhhn2XuKbcK/RP/UEaXam+VNdprk+u6+TZkao3qzhav9YL7r27dqTz7v5YavEu34FXq6v9ok65V49qWeM9TkMKFa6GtPivkx4aPbv4SHTHNe/APhUN+cDtsLqSL/+/tGTD6JPJc9biOzEE3ggTgR/Aaw4MGPz+urNpuASeEBO/gs3Z+4k1LdCA4lDJ7YKHgX/nkLP79QthJ5piwa27t+ZuB2pb0niZIN0pwj0LXtuU8jcgd9eKm+QmhcvA0ALLUkEhZGy3E6C+ioBUcH19Dd64pJwf2FPyjTl2vyKjTkAB17Um+VcvKs86HucCPYZ3CeeTYwOGm/BHkXhGzEJifDJ521lbwfdu95f3TQ1Qe/ootyEOd/KhJtRRypaY /3yljuz0 EvbwIrEu6jjcFqqDaqt8al5twr4LbB+N8bzUQ/Q7BX1fGFhR3FCrVsS2vTQ== 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: List-Subscribe: List-Unsubscribe: On Tue, Jun 04, 2024 at 03:57:54PM +0800, Huang, Ying wrote: > Byungchul Park writes: > > > Changes from v1: > > 1. Don't allow to resume kswapd if the system is under memory > > pressure that might affect direct reclaim by any chance, like > > if NR_FREE_PAGES is less than (low wmark + min wmark)/2. > > > > --->8--- > > From 6c73fc16b75907f5da9e6b33aff86bf7d7c9dd64 Mon Sep 17 00:00:00 2001 > > From: Byungchul Park > > Date: Tue, 4 Jun 2024 15:27:56 +0900 > > Subject: [PATCH v2] mm: let kswapd work again for node that used to be hopeless but may not now > > > > A system should run with kswapd running in background when under memory > > pressure, such as when the available memory level is below the low water > > mark and there are reclaimable folios. > > > > However, the current code let the system run with kswapd stopped if > > kswapd has been stopped due to more than MAX_RECLAIM_RETRIES failures > > until direct reclaim will do for that, even if there are reclaimable > > folios that can be reclaimed by kswapd. This case was observed in the > > following scenario: > > > > CONFIG_NUMA_BALANCING enabled > > sysctl_numa_balancing_mode set to NUMA_BALANCING_MEMORY_TIERING > > numa node0 (500GB local DRAM, 128 CPUs) > > numa node1 (100GB CXL memory, no CPUs) > > swap off > > > > 1) Run a workload with big anon pages e.g. mmap(200GB). > > 2) Continue adding the same workload to the system. > > 3) The anon pages are placed in node0 by promotion/demotion. > > 4) kswapd0 stops because of the unreclaimable anon pages in node0. > > 5) Kill the memory hoggers to restore the system. > > > > After restoring the system at 5), the system starts to run without > > kswapd. Even worse, tiering mechanism is no longer able to work since > > the mechanism relies on kswapd for demotion. > > We have run into the situation that kswapd is kept in failure state for > long in a multiple tiers system. I think that your solution is too My solution just gives a chance for kswapd to work again even if kswapd_failures >= MAX_RECLAIM_RETRIES, if there are potential reclaimable folios. That's it. > limited, because OOM killing may not happen, while the access pattern of I don't get this. OOM will happen as is, through direct reclaim. > the workloads may change. We have a preliminary and simple solution for > this as follows, > > https://git.kernel.org/pub/scm/linux/kernel/git/vishal/tiering.git/commit/?h=tiering-0.8&id=17a24a354e12d4d4675d78481b358f668d5a6866 Whether tiering is involved or not, the same problem can arise if kswapd gets stopped due to kswapd_failures >= MAX_RECLAIM_RETRIES. Byungchul > where we will try to wake up kswapd to check every 10 seconds if kswapd > is in failure state. This is another possible solution. > > > However, the node0 has pages newly allocated after 5), that might or > > might not be reclaimable. Since those are potentially reclaimable, it's > > worth hopefully trying reclaim by allowing kswapd to work again. > > > > [snip] > > -- > Best Regards, > Huang, Ying