Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp44051lqt; Wed, 5 Jun 2024 16:42:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQu4k7q+gEGD0ULu7Pjhk2dTT3j/axkzxzUTqRbkbD9XbgUDVJSRMmGtXdl3NyqdX9cfIf0CFGZyBraC8jhhIsZMVm1qS7g7/Xn6bHYw== X-Google-Smtp-Source: AGHT+IEiWv74VAyVzrDKOUVDd6/F4ef2uPDLr70KV17Qw6tXRMj/W2ShOQEcKcz4yGyZD7bAeGly X-Received: by 2002:a05:6808:1288:b0:3d1:e0c8:cc6a with SMTP id 5614622812f47-3d2043d4becmr5713441b6e.46.1717630939442; Wed, 05 Jun 2024 16:42:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717630939; cv=pass; d=google.com; s=arc-20160816; b=XwCZEQVs8IuSCjAoX1GJFOlT2wAXZqwdXQjbfYziTknC/3lFJfjtvw+FLxhJ1vpSQ1 g0yaMyUksf0IwhqC4iogSu/GRInUWWy9SoTdK2iFH2zQkP59E1GG7anTvWQm3emiGzvf UzkkFT29jGCCLZ3G8YOUasYWzvktf93CsH8hp6TSnEcWkeYytvOejKJX5a4iey5Khsc7 HSapgVfP68JxHR18OC5jvJb5pX7I8q6lcsdAQ1LAG/Dj8ph9Q6bVcC6F7pb2N/oIQky7 v870YtBGzQ9i3tk85jDb1JIB2MaEmQ/8rNYdkOfZOs5ue8LEfnMtj0ure+3nGL6/YJw3 3PBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=fURZ+GlEwn1DW8Z6q3RkvHuwBmyZjfx8HFK5EMb98t4=; fh=BeSD+FdoGF0eJ+5Sn0KQGRj5cCnjaa3hwf3cyp25mNw=; b=rG1DnD9L9b0BwKXRQsyjlcGwcEV1E7Ndem4AM8O+m1Tlmtpgg8SNQoDAfqZPfws6Pu rDb34r15OkO0O5MN+S6ep99TCBD5HaCZOA0HzXIAMEixG/RTicCKgcRjP8hke2ZDPC4a m6vtQwm3EomShita/VUYYblcIHkqebkboVvRFjqxhzE4lRPOwSYt7uJ2GXRtPEFVjvUH GcR3yiT6FMuIwLd9gsaoheGLEhFHnDYKxoFZPaUCJ1W9Ga0dGTmU1811Ui5sFPrLFXwm wrO2L9Ikx07MV8C0byOY8JXGBme4W17oyWBrzA0dONRr5MLmGy4ACcmhSEW+RAlf7xi1 fhBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=C+1BGUSF; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-203413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-79532888548si14814185a.187.2024.06.05.16.42.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 16:42:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=C+1BGUSF; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-203413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CE0B51C22FE8 for ; Wed, 5 Jun 2024 23:42:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E378167DA2; Wed, 5 Jun 2024 23:42:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="C+1BGUSF" Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A0A415FA60 for ; Wed, 5 Jun 2024 23:42:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717630933; cv=none; b=WNNq9pyT6oAiobI1cL/ILPQiK4UfGTlDkZFWdORntjZ+X5xMzpk9g1JOkcN7GVp4x4a75APyfekUAX3QrGcNJPuIkqMfqDV0BU5nDiG0eb64OcynHqcTdr3U551KrghybB0N1x5JilzMuh5p9cLSbKPRSQiVvDf4CiIwZTbdR9M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717630933; c=relaxed/simple; bh=fURZ+GlEwn1DW8Z6q3RkvHuwBmyZjfx8HFK5EMb98t4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=We3xZ7ch0PNUy8oYLjJpMXbVt2D1dpGTTJFewyYh3YfrqdKA8bz86zIbszRrQCMGy05MXWw+5N8Qu7x0UP1qBdT7ZUpAhyDKtNrf0YCeSUUYT86SfosyE4qj3eAEE+F0TKq24zRoBQW4VmB+AC76WFcFjXCrVyG9QHpW/ncHASg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=C+1BGUSF; arc=none smtp.client-ip=209.85.222.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ua1-f44.google.com with SMTP id a1e0cc1a2514c-80a8770ff33so139940241.0 for ; Wed, 05 Jun 2024 16:42:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717630931; x=1718235731; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fURZ+GlEwn1DW8Z6q3RkvHuwBmyZjfx8HFK5EMb98t4=; b=C+1BGUSFeF7N7zfda926Y/Ks2+gvKd3OlQzjKFfhZ3JgyIL3CG+/MkOfM+FOq6QdEr FfopwMGsHcSjPb1Ur4aL0kzrApCpKDdTdE7KBxNac3LJRqdC8bvd/FM6Y7WPLVX8RPoF CFTceAY/OS2wMYoYxnMvz2me+yQOdqX/M2FDm7zV5N65z9/VUk9Pjrm4H6Ag9t1Raswl rngSLVMQaNNf/e8ImL3R6KX6ACVOcb6EA71YBW6/00TfFXO8HvWyId+EbExfWHif9EWy pH0eXG//IsplXcXmnI/j337/rLiKdi6whgNnoSZhLbeh+CZzcuUnWoBgBhgkcmafn64E atog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717630931; x=1718235731; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fURZ+GlEwn1DW8Z6q3RkvHuwBmyZjfx8HFK5EMb98t4=; b=MDSC3dNSUFIp6HFKO1VBkVq0nZUg0an8cdyWReRFGCuu36PXtod4CH1F0IxdCm4rGf FORxvmp4yriHqL1aXWNB9Sxc+aRNhgO1CAL4oVAnh5BHnvgpfItbwY03oLVHEdcXoG6o aP1o4GEV2ZdfLLji1nRKJkwqTjhRPcLNU1RuU1GUTtgcle6Nsh4AM+4SMzH7p9qJbowT IzuBLBQLUdC5wFcDdgxyOR3jSd9t1+ShEWuKvei4TRpXR/xbiJ39L8dCm1caHiBiDfWD dz7gkRtFLODAGRpNSiEJPsh7VKmOB3sma5guk+YhjaiC62Cs6BUKy2oXTcK9B2nzyCkA uTHQ== X-Forwarded-Encrypted: i=1; AJvYcCX+M4G7qP1oRRu6wyDqV4AEPVEfb+1/SYPXAXBaznvI55P3ZPliVPsCvOiaeloYxGSIZGaO2xD4n1GtNlmqI8+cNwO9jJzikA/qr/cH X-Gm-Message-State: AOJu0YxfSZsUS8/ORCB4/EnUpVmTg2Gr7b0i7bMryadwq+q6dgEyF6du Z1eD+gTzbe9sNgBuTyAkGu5KpZq/ZvbFMy06jw7l4ed4rgVzwInznoyRxEIPCNpfj92ATbttEsa /Tr4Rw9DiftjHbwauB6wcvWYQnxXb0DzFzQkq X-Received: by 2002:a05:6102:5089:b0:47f:40f7:2b5f with SMTP id ada2fe7eead31-48c047f4db6mr5870916137.5.1717630930642; Wed, 05 Jun 2024 16:42:10 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240508202111.768b7a4d@yea> <20240515224524.1c8befbe@yea> <20240602200332.3e531ff1@yea> <20240604001304.5420284f@yea> <20240604134458.3ae4396a@yea> <20240604231019.18e2f373@yea> <20240606010431.2b33318c@yea> In-Reply-To: <20240606010431.2b33318c@yea> From: Yosry Ahmed Date: Wed, 5 Jun 2024 16:41:31 -0700 Message-ID: Subject: Re: kswapd0: page allocation failure: order:0, mode:0x820(GFP_ATOMIC), nodemask=(null),cpuset=/,mems_allowed=0 (Kernel v6.5.9, 32bit ppc) To: Erhard Furtner 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)" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jun 5, 2024 at 4:04=E2=80=AFPM Erhard Furtner wrote: > > On Tue, 4 Jun 2024 20:03:27 -0700 > Yosry Ahmed wrote: > > > Could you check if the attached patch helps? It basically changes the > > number of zpools from 32 to min(32, nr_cpus). > > Thanks! The patch does not fix the issue but it helps. > > Means I still get to see the 'kswapd0: page allocation failure' in the dm= esg, a 'stress-ng-vm: page allocation failure' later on, another kswapd0 er= ror later on, etc. _but_ the machine keeps running the workload, stays usab= le via VNC and I get no hard crash any longer. > > Without patch kswapd0 error and hard crash (need to power-cycle) <3min. W= ith patch several kswapd0 errors but running for 2 hrs now. I double checke= d this to be sure. Thanks for trying this out. This is interesting, so even two zpools is too much fragmentation for your use case. 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? In the long-term, I think we may want to address the lock contention in zsmalloc itself instead of zswap spawning multiple zpools. > > The patch did not apply cleanly on v6.9.3 so I applied it on v6.10-rc2. d= mesg of the current v6.10-rc2 run attached. > > Regards, > Erhard