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 74083C27C54 for ; Thu, 6 Jun 2024 13:28:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E7BC36B009C; Thu, 6 Jun 2024 09:28:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E2B4D6B009D; Thu, 6 Jun 2024 09:28:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CCB846B009F; Thu, 6 Jun 2024 09:28:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AFD9A6B009C for ; Thu, 6 Jun 2024 09:28:17 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0E09E81664 for ; Thu, 6 Jun 2024 13:28:17 +0000 (UTC) X-FDA: 82200542634.07.5078D86 Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by imf13.hostedemail.com (Postfix) with ESMTP id 8DB9020013 for ; Thu, 6 Jun 2024 13:28:14 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=mailbox.org header.s=mail20150812 header.b=i0bJgvUi; spf=pass (imf13.hostedemail.com: domain of erhard_f@mailbox.org designates 80.241.56.161 as permitted sender) smtp.mailfrom=erhard_f@mailbox.org; dmarc=pass (policy=reject) header.from=mailbox.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717680495; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0Dtvu1UlIWg/CyjYI2WZ3p7cEYopcAzSKORkCKBmMBE=; b=MATC0r+WS9QGAGA6o1Fqy6NHe+1G7sdn80fvUz9YJjdemMp7pVboKG13rhPsEGa7dvecdL xYqTPo5xa3wR/BIaMzJSn/2UdsMzSmMbFj4YGJyzYgesppA/TkvkxLxZU8cs3aXph0QG6L NykXcALz4yckg1JM+ujXhE6GWk7FOg4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717680495; a=rsa-sha256; cv=none; b=K5Sn3GoeabAqArLwGFvv0tlrlPOIi7DiCIis7tePc/nIHLIHZ7YVhKbGELHMktCVTqphFe 9RbBbdvAMQFo1czmF482ro1V3ChjrCG+zs1KoZPo4TW5IHefi4grOxB9MvbaydwQuGhHxk GZnofZR3T+9VaER/P4bzJ7EWPrCE+RQ= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=mailbox.org header.s=mail20150812 header.b=i0bJgvUi; spf=pass (imf13.hostedemail.com: domain of erhard_f@mailbox.org designates 80.241.56.161 as permitted sender) smtp.mailfrom=erhard_f@mailbox.org; dmarc=pass (policy=reject) header.from=mailbox.org Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4Vw4s56fxZz9spj; Thu, 6 Jun 2024 15:28:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1717680489; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Dtvu1UlIWg/CyjYI2WZ3p7cEYopcAzSKORkCKBmMBE=; b=i0bJgvUiVSAuNlq7G+F3qiJ2RCcDOW+mdGSowdG2MqgvDHwHkCLQnkYGV5Q2n6jwrq9hJw skdkUhlSDga/AEtoR/2cpS2pR9r8ZSPMfPWXW19zQqCe5wXu9a+R127RISLZEPznrF2HUh k6l65Z+RCds3VgmhJacG8zCZ571hX2ucyLEKDERxTX2BL3uI2IlITzL7rmmoCV9RymvMmy NSoWOHp/as8gVr00+ZaCju0beiLCdxGWbgEKhVYG0Iluav0T6OJkZzlohyotQPT6sv9Dka YWe3K1sDsE+j8XVtcMMoe7b6Nu36agmI1kVYbL8ph0d/zb0lWVJexA2qzehFFQ== Date: Thu, 6 Jun 2024 15:28:02 +0200 From: Erhard Furtner To: Yosry Ahmed Cc: Yu Zhao , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Johannes Weiner , Nhat Pham , Chengming Zhou , Sergey Senozhatsky , Minchan Kim , "Vlastimil Babka (SUSE)" Subject: Re: kswapd0: page allocation failure: order:0, mode:0x820(GFP_ATOMIC), nodemask=(null),cpuset=/,mems_allowed=0 (Kernel v6.5.9, 32bit ppc) Message-ID: <20240606152802.28a38817@yea> In-Reply-To: References: <20240508202111.768b7a4d@yea> <20240602200332.3e531ff1@yea> <20240604001304.5420284f@yea> <20240604134458.3ae4396a@yea> <20240604231019.18e2f373@yea> <20240606010431.2b33318c@yea> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-MBO-RS-META: 9cdrbmmzzim9aobuo91px9dgth17d51n X-MBO-RS-ID: efa5f4499ea98264111 X-Rspam-User: X-Stat-Signature: tt6549pi5p9a5zpfopjymo9b1yzg3y5c X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 8DB9020013 X-HE-Tag: 1717680494-496598 X-HE-Meta: U2FsdGVkX19BZfr1ZQOzA97vnUYrDFSf9u/oelwxw8bjbBX1V6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VRHgrmTi7+O8aFZw77rs58rUnlm65tiMRSwDfUy6+IeoEPds1IZggiuXqBwCBLwCSuQPh4iY/Z/zHuheBY7Ewq7AmFsgwyRencDli8tYHdFyhQmldtmRS1YdgINqw98PrC5s6/SWxIgcwFPNeZT4ie95kyL1lSUC9sfSqj7pM1m/2YRylWN 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 Wed, 5 Jun 2024 16:58:11 -0700 Yosry Ahmed wrote: > On Wed, Jun 5, 2024 at 4:53=E2=80=AFPM Yu Zhao wrote: > > > > On Wed, Jun 5, 2024 at 5:42=E2=80=AFPM Yosry Ahmed wrote: =20 > > > > > > On Wed, Jun 5, 2024 at 4:04=E2=80=AFPM Erhard Furtner wrote: =20 > > > > > > > > On Tue, 4 Jun 2024 20:03:27 -0700 > > > > Yosry Ahmed wrote: > > > > =20 > > > > > Could you check if the attached patch helps? It basically changes= the > > > > > number of zpools from 32 to min(32, nr_cpus). =20 > > > > > > > > Thanks! The patch does not fix the issue but it helps. > > > > > > > > Means I still get to see the 'kswapd0: page allocation failure' in = the dmesg, a 'stress-ng-vm: page allocation failure' later on, another kswa= pd0 error later on, etc. _but_ the machine keeps running the workload, stay= s usable via VNC and I get no hard crash any longer. > > > > > > > > Without patch kswapd0 error and hard crash (need to power-cycle) <3= min. With patch several kswapd0 errors but running for 2 hrs now. I double = checked this to be sure. =20 > > > > > > Thanks for trying this out. This is interesting, so even two zpools is > > > too much fragmentation for your use case. =20 > > > > Now I'm a little bit skeptical that the problem is due to fragmentation. > > =20 > > > I think there are multiple ways to go forward here: > > > (a) Make the number of zpools a config option, leave the default as > > > 32, but allow special use cases to set it to 1 or similar. This is > > > probably not preferable because it is not clear to users how to set > > > it, but the idea is that no one will have to set it except special use > > > cases such as Erhard's (who will want to set it to 1 in this case). > > > > > > (b) Make the number of zpools scale linearly with the number of CPUs. > > > Maybe something like nr_cpus/4 or nr_cpus/8. The problem with this > > > approach is that with a large number of CPUs, too many zpools will > > > start having diminishing returns. Fragmentation will keep increasing, > > > while the scalability/concurrency gains will diminish. > > > > > > (c) Make the number of zpools scale logarithmically with the number of > > > CPUs. Maybe something like 4log2(nr_cpus). This will keep the number > > > of zpools from increasing too much and close to the status quo. The > > > problem is that at a small number of CPUs (e.g. 2), 4log2(nr_cpus) > > > will actually give a nr_zpools > nr_cpus. So we will need to come up > > > with a more fancy magic equation (e.g. 4log2(nr_cpus/4)). > > > > > > (d) Make the number of zpools scale linearly with memory. This makes > > > more sense than scaling with CPUs because increasing the number of > > > zpools increases fragmentation, so it makes sense to limit it by the > > > available memory. This is also more consistent with other magic > > > numbers we have (e.g. SWAP_ADDRESS_SPACE_SHIFT). > > > > > > The problem is that unlike zswap trees, the zswap pool is not > > > connected to the swapfile size, so we don't have an indication for how > > > much memory will be in the zswap pool. We can scale the number of > > > zpools with the entire memory on the machine during boot, but this > > > seems like it would be difficult to figure out, and will not take into > > > consideration memory hotplugging and the zswap global limit changing. > > > > > > (e) A creative mix of the above. > > > > > > (f) Something else (probably simpler). > > > > > > I am personally leaning toward (c), but I want to hear the opinions of > > > other people here. Yu, Vlastimil, Johannes, Nhat? Anyone else? =20 > > > > I double checked that commit and didn't find anything wrong. If we are > > all in the mood of getting to the bottom, can we try using only 1 > > zpool while there are 2 available? I.e., =20 >=20 > Erhard, do you mind checking if Yu's diff below to use a single zpool > fixes the problem completely? There is also an attached patch that > does the same thing if this is easier to apply for you. No, setting ZSWAP_NR_ZPOOLS to 1 does not fix the problem unfortunately (th= at being the only patch applied on v6.10-rc2). Trying to alter the lowmem and virtual mem limits next as Michael suggested. Regards, Erhard