Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp556703lqt; Thu, 6 Jun 2024 11:04:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVCISTVlyAtqu7+z0MnTq0Odr61aJ3E/49CVdx3v4S1otEm8mpIGA4xrBTCCI9vlHbrfEzBdv0sJm76+m3h06fZiY72v5XHwFZoWHXoow== X-Google-Smtp-Source: AGHT+IFqg0pQItt50w3yRz6gkOZxwFsDVAXMAvyf3T11BbdFh5v+cwMrcrIW9r7KaL0Ivqj1gA3D X-Received: by 2002:a17:907:3da0:b0:a6c:8b84:3bea with SMTP id a640c23a62f3a-a6cdbfec4fdmr24060566b.75.1717697042757; Thu, 06 Jun 2024 11:04:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717697042; cv=pass; d=google.com; s=arc-20160816; b=jDRSbyDWEKUjstxXiwPrFDN3lAONcGVZhhZqKSF1jVmPMRM52ig/Ej16eTC7PzrjGF KAjLRAt7DN6uNAtMxXcyhvjFcLRY7lUrX0zc5Zu5i/hidciHr8Pec26nOc9N8DTjrSY/ FColYAT1cHWBIa+/Z6yYUp2Vvk3ybmGSqtD+4xmY1GjcA4gXV2EAz4/vZfKoKgb5D0nm +ou3GtQZgaw/hrMSSxAGlxu12FDFeZ3cVBFbsOKDhHvXuR0089wWFLtPQ8NZkto3QU+4 IipxztWrm5vsr2ZAdx/b7702pHgsJPQ0LiNps2j4tJx02AjY9iqdIIAuDZmemrAfAi25 MF6Q== 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=fmY9ClhcMnk3lfJDa8OPw7iQg8oOX8VXIGEoCMmXzxs=; fh=t3LOTiQ5VBD2FcMdBvg0LdwZzD/vObiuhM7vas4Za+8=; b=a6+IMI5DVmLTfUO12oo2qc7OMfIV2Z+I+/M94ZKLi04Sl9JjqzHsD5q5xBdRnyH/Dy SrWIRl6+HlzLggbJeyB9Kt2f2LQhCK1IzN4u0hjbAFy6s6T2mpbgOiYXSsiGuEMptFpK 9YWYsCyGOq306o/lGttvsQWRBojn+tqCptFeUj14PtjlQ9hRQF0RRtm2WrjHgQJGRPs9 lMOFh5eNp4bw7N42qTBdH1enS26Mx9YyQdOqeutdtFqY8u9aFE7CZQzlKOYJms0kNryg IaT1wjKzFEMbWln+9ll1YlegGXCplymIseS6Piqxvz6/1ctqz9NBrdQcUtlHT/niczdm jvsg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=3YW4o+gG; 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-204850-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204850-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c8070c024si92378566b.598.2024.06.06.11.04.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 11:04:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204850-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=3YW4o+gG; 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-204850-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204850-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 48C811F23D35 for ; Thu, 6 Jun 2024 18:04:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E6A819923D; Thu, 6 Jun 2024 18:03:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="3YW4o+gG" Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (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 CF3C31991D3 for ; Thu, 6 Jun 2024 18:03:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717697034; cv=none; b=pXW5/ENj4Gbl+1QGVKYkHkwgooJjMsDTqu8KTyFTkilcXsOtaDCJKzRRxpGAOdEt3OI12KbKtUfDwBE7zxch2iuNRqlQrWFq2PMjq7a2MHq1lYfZrtYw8OjQariwC11Ov/1y8f/crrWLen7WR46+cwWTTEbtkSNfxbymCSZdgFw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717697034; c=relaxed/simple; bh=OLlDyOEx/tnhcZ/wuPqcq30hMBwlqIfw82OXKbyQd/4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=elX0cmqTR/+9s8KsJq7N2VLGlxQDRTEpq7Knff77SJrEbC4J6izgP8l8QySBuno+NRy7cj44mHRasFsnhDm+78GehTpXoT9g4yy+op+LLt2x8xazIRhAliQItUP96TAR4SLlMR9hOQZXz3F+hGnz/64BE8H66Tr6YNQzJCF2g28= 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=3YW4o+gG; arc=none smtp.client-ip=209.85.167.178 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-oi1-f178.google.com with SMTP id 5614622812f47-3d20c0fe970so476658b6e.0 for ; Thu, 06 Jun 2024 11:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717697032; x=1718301832; 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=fmY9ClhcMnk3lfJDa8OPw7iQg8oOX8VXIGEoCMmXzxs=; b=3YW4o+gGWsLNY+NPzz8Jf/S6lhyt8EyESbFr+sWfS6TfDQeCe+UR3fKgWamZcUsLFY OvHWNjtya4Qk5yFGpsUfEqOm3HrV3YZVozqsqb6SQq7MQ9SD3Y7F9d0jKCnZNAa5KDte ZnX+vPGCviT8WMZyox1tNsxgYaRii6al94f/Bd0w5u1r23O9NGfOdlAEnq18Yg5jkxm3 IEw4FuLFLY44bjf14ZJDX1c37cdcqofZVQSri1NBBdKhpeiVPHK3qQ3ZjN4HgUJKwrBY DW/afYAxRvPDZNMAD31yx3mhOi+VxSEbZxd4utA2rAYg5oR1A41PosFt4f+2PARMXynL VLvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717697032; x=1718301832; 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=fmY9ClhcMnk3lfJDa8OPw7iQg8oOX8VXIGEoCMmXzxs=; b=tx2oqqWbIomKq+dzrh/a4H3a1YFRzj4lC4HtJZwtC+Y436t5ZruGyr+p9qhdxS8WWS Pif4es9FMmrrL0c24Aj1SvHvsLvJl1WE0UeDaY3fQbFhWX8CbSdFPLHbd9LY71lcYa5b 5//wWmXsGvOg1vdT9SKCqa3OI6QT8yu+WfAlzbadjYPPTSdDqU80uOCo5aLIpdI0lDjP D8mBAB+2+gdHyDvBwFofXjiKEkrG67I0H5qe+MO1+gFyZWCHzbFnDyetAg10VbZ7KhMP Guv9ynMgwAWY2eX4kWmS4VP1OTqvvR+wtIZWKAh7FwjUo5dt/mqYBuIesoCFlMNiisft phGQ== X-Forwarded-Encrypted: i=1; AJvYcCWeND7EkIzbZzweiQPCeAT92jvq8Br1Avcu68rt9EMpCfkjci0/BrXlypc0KwrRPKSKEtdMLd1YIvrtuxlyXlWjLgIDdz3AxPIqSM/4 X-Gm-Message-State: AOJu0YyAYELqqXQkvBfhRI+pSBFK3IuOwFOooRvYZcAgmYr5kiQluktF 2KptR7bh1Vhn4wLrPZW3CuCUiz0TNBTsBqAjiPzdXS+qAomusq8XX7xM9TVkMrLLjMvhBK3BJOY 0KD3WIhYn3aSjW3I9BXPXHpCeIb6Bupv0uDgK X-Received: by 2002:aca:130b:0:b0:3c7:50ac:c570 with SMTP id 5614622812f47-3d210f072b9mr155114b6e.44.1717697031595; Thu, 06 Jun 2024 11:03:51 -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 11:03:13 -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: Yu Zhao Cc: Takero Funaki , Erhard Furtner , 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:55=E2=80=AFAM Yu Zhao wrote: > > On Thu, Jun 6, 2024 at 11:42=E2=80=AFAM Yosry Ahmed wrote: > > > > 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 CPU= s. > > > > 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 increasin= g, > > > > 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 numbe= r > > > > 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 u= p > > > > 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 ca= n > > > 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. > > Not to choose a camp; just a friendly note on why I strongly disagree > with the N zpools per CPU approach: > 1. It is fundamentally flawed to assume the system is linear; > 2. Nonlinear systems usually have diminishing returns. > > For Google data centers, using nr_cpus as the scaling factor had long > passed the acceptable ROI threshold. Per-CPU data, especially when > compounded per memcg or even per process, is probably the number-one > overhead in terms of DRAM efficiency. 100% agreed. If you look at option (b) above, I specifically called out that scaling the number of zpools linearly with the number with CPUs have diminishing returns :)