Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp546690lqt; Thu, 6 Jun 2024 10:46:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU10wkaDGvs2H/MUVnClezE6GdVk1OCjwn2y5MlCjNZmbWo320baXy69nQ5mZpV2Hcokri49UzGIqKfIwrsdhx3jcInIFpkjCFRGpwq4A== X-Google-Smtp-Source: AGHT+IFK4t/S+jeV0euTx+bCVkORQznEEjzySpz4+kJYBOdkzx3OHJ1/9n0YWZc68q79IfK7MjUw X-Received: by 2002:a05:6602:134b:b0:7e1:7e89:f6ee with SMTP id ca18e2360f4ac-7eb57124cecmr63017139f.0.1717695971159; Thu, 06 Jun 2024 10:46:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717695971; cv=pass; d=google.com; s=arc-20160816; b=RFtbzvYdm8gEhX7lc3Q1rRmsHLtbATHDB88uCqNjhcUmA4tCUMqqVZLIE68a8cWpk+ XtzszkM8sRfSfEtHHOB6F36Qp3gqBaCDB5pRW4bxGu/V7204VIzyDv1uOoLv+wJj9niB 9vMHikrvKb6O8tEWFvMY0+CHb6OUzFS6oiKNzqzdYM1VnzQNQUsVhw8ErBmli1zsk+0K T5ICnS19xURFs9SoULGpRkBo9WMeo3G9R/UlGIjt2S/rtdr4FDAUQPzhJDBJaiQD14h1 NZGYIAMGwD0wehThUMVRDLT/R80iUUs1dO1ZS2RyT7Ku7y3ig6aS/npZ74460eGsMhZo JRTg== 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=v1Ut3Dkh+dW6ZjfW0SAbH75TKykJw59snMxcOhxXPyw=; fh=jrvc67qvIPUwIztbiJTDFvFM+SajKMvax4dBszCz91Q=; b=Hw9WBelnoATVJXF5XbPZgr8aQFBLF/GY6kZi1dN3ShAxkdeJpjl2eBoTWMR2MS0rom j6oP7zp7EcycJK+YWga/k66FqbFjCYRjWDFYHqg9dZ2hoZJT69HPHFocEdr8gskisLT/ UZTsw5sO7mW2nLlB6Z5yJ5p2imLQRkV9ay5Ge6bC+Ix5arh0gLmdiiT7qof9r/HBDsu0 CKgX+dFebpsWF8Dc+WhY/yoIGtB2PLnLYTil+O9q6NueBplb0hApUC6ZSf4CSGaXzmGN y+uoR+uTLgElD8BG+W9z32V5QLMZWCw2ksqQ4BNkOEbZVnsXtoCe/dZ3C8DmMKA1GRUo G6fA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=fIfgnLn4; 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-204828-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204828-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de2760a786si1472450a12.506.2024.06.06.10.46.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 10:46:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204828-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=fIfgnLn4; 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-204828-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204828-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 734B9287D5F for ; Thu, 6 Jun 2024 17:42:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B37B51991D2; Thu, 6 Jun 2024 17:42:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="fIfgnLn4" Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (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 48C00196446 for ; Thu, 6 Jun 2024 17:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717695754; cv=none; b=mbgT9jcBotfzjlopNu8yXovjN45gZg5m7mt7OLsADxBkFx4Zdte0okIt3mBsfPxOCG0mFFzWWx37Nr0wrT5EqdAw39ffeq4Lw81OuGV9j6jOSXhEy0sK227pgEPZvr9WoihUgtakkI9qI7gp9o/5i2GaJFbWa3VWN2muxXsFI0k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717695754; c=relaxed/simple; bh=BpLUPhuD0Jaux9zNhc6cZoFq9PmN/G6ECDCzUrjjxS4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=s/NOYZIScpEY7X+U9NicbGpwMiXG2xgLtQzfoZzGYL8wC+W72OBdn+Gt0iQHo1Jz3kGGf0vl1BYqKVz/7W1ZkyoZeJ1MJiUDQz2hBG3z994s3fPi+vx+EMx+K/xwP9PGseYsxc4w27qmL0ysYIayHQoRTscAvkPbF39wrbzMOcY= 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=fIfgnLn4; arc=none smtp.client-ip=209.85.218.54 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-ej1-f54.google.com with SMTP id a640c23a62f3a-a62ef52e837so164521066b.3 for ; Thu, 06 Jun 2024 10:42:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717695751; x=1718300551; 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=v1Ut3Dkh+dW6ZjfW0SAbH75TKykJw59snMxcOhxXPyw=; b=fIfgnLn43TLsPR67Nwd9jEMggcE7WTgraq9BFtMESX2rpqQ5pvzvJGIkjIY+QHVpnf TMzy7aC4+/iJ+NrOlVJVIFLkNO/AHvTqFVF8PvpuHJ8eajmr6IfRgGwcNr5rg9Xp1rpO va+xxLb+y4PPPegbq2Bppc9GuQHt2hjsqIMgUrmJ7IMwWDJ7/fPZKFHIn3OxAYTKPW/q Xt6O5QSAMOizYVUAP/VGeEAJmfHpEi8nOZMdlf7NZ9jVLST7ahb7kiIKt6YKT2mBpQb6 j7gjBvL+FsZqnNUqKPcYqd4hEFeqxXZ0FYZWkAFiH5rHCLcbghSEiyoBqkHH1ZpMZbRQ 1y7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717695751; x=1718300551; 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=v1Ut3Dkh+dW6ZjfW0SAbH75TKykJw59snMxcOhxXPyw=; b=bu2f7RW2IxPB6C9BG5/1Djlg0D1sp/YNf+kNyO9Nxlp+WnfC10UfBMi/YW0pufr4ac Chq30e/pkGQZgcx1QGICnzBiNHoOHSXyQPkQoyxzQeo1DoBOgH+q+pinpQI0O815vjR9 c5juqrGmFqNQb41WNzFbPfpX4qQTWinWKgHseMh7ur8fF9W7UcRdc6yk/RVYZbI2KjnV mSjL/yekv/efATGNJvNiPB2QUO8Fa0kRFlP6qTzGsmrVzrvRhIBEqRo0/MQTPKl63l2D 14RdVkspL8IGMrIOJyR4eCexST+l58fHNDRoc7TJIElg7i0vS0GIJp3SUgh9zHT4tPmS F4Dg== X-Forwarded-Encrypted: i=1; AJvYcCVqEwalCcm2MH+n7Vg6pUOdtrzxNWZs5Dsfkc2C18QVZoMwRHvZg4RB2l6Hyc75K2Q9K8avNq1st1ogQIEpEhNOMxdDtZvA2pDYLq64 X-Gm-Message-State: AOJu0YxV7xm9yY68LjeVpdJ6FZEkKfYeTj122sk79CAJR9SydCwu/nPA voYghkf9267smwG6J9ORWhS3Dkn3W8K3Nnk9e9RjnCxgmLHGW8dsClJsTzh+WYF7WY/2VRA9ts6 LBuhHFDyeC1hLe++WAj+PHZrepCYi46IFP4Wu X-Received: by 2002:a17:906:fb11:b0:a68:c5b0:9890 with SMTP id a640c23a62f3a-a6cd7a80f9dmr20626266b.42.1717695751357; Thu, 06 Jun 2024 10:42:31 -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: From: Yosry Ahmed Date: Thu, 6 Jun 2024 10:41:52 -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: Takero Funaki Cc: Erhard Furtner , 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 Thu, Jun 6, 2024 at 10:14=E2=80=AFAM Takero Funaki wrote: > > 2024=E5=B9=B46=E6=9C=886=E6=97=A5(=E6=9C=A8) 8:42 Yosry Ahmed : > > > 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)). > > > > I just posted a patch to limit the number of zpools, with some > theoretical background explained in the code comments. I believe that > 2 * CPU linearly is sufficient to reduce contention, but the scale can > be reduced further. All CPUs are trying to allocate/free zswap is > unlikely to happen. > How many concurrent accesses were the original 32 zpools supposed to > handle? I think it was for 16 cpu or more. or nr_cpus/4 would be > enough? We use 32 zpools on machines with 100s of CPUs. Two zpools per CPU is an overkill imo. I have further comments that I will leave on the patch, but I mainly think this should be driven by real data, not theoretical possibility of lock contention. > > -- > >