Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp551581lqt; Thu, 6 Jun 2024 10:55:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUxDugaxb932eyaBSDLdu51WwXY/P2yE5M1Ys1WcD39lCN9m2tT9L+Z2lPlSCxKzsBPoowlnHbNYzIOy5LX/a2tlu8I9Xnke9G3dLWgaw== X-Google-Smtp-Source: AGHT+IFm4OOhyKof+NcK0O17ZF4mUd4v3tUeg/G0S4KFnL4d2EyBL5W1RSYxYSae1nhi0BVcmAFb X-Received: by 2002:a05:6808:495:b0:3c9:6a26:5734 with SMTP id 5614622812f47-3d210f7f08cmr115664b6e.56.1717696549308; Thu, 06 Jun 2024 10:55:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717696549; cv=pass; d=google.com; s=arc-20160816; b=iDBV4H+B+AHWuZapQvsfCZT5Bav/YeblkAfcnOaj9q3Sz1NXAXuWrCTKQEEMGKjaGy w0MUJalm/p3vve1iCXttU8mqSdD7vDEsZ3DTlqyKpS4veoGzDAhm+17MDKPvgSfHTK15 8n05fxDr/5M/5VGvU3XdyrEnBH6PW5HJcjwPNbjqRW+ut/XnE+A++5pvwHkLhAuVtgVJ tvvKvQy+P1uOPDYfvBe3QAIPTkANvButKTP6w6tpduU10zMy5mkun2b3onncVBNpjr2A 47NqnD4AalOxCoR5b7BZb1QMcw/TeosigTW6uNWNs6mtWRxXkJ+OnyDn7zdaPhJx88N1 qweg== 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=70T0ZceHUGMDadFXNyVFFMOsXxBYbdVP4L874egq+7s=; fh=9XHc0pK3ecTheYg9rfFk98E3qJq4ZtlUs+q4ToZTBP0=; b=STQAgbIn6GdfcxnxtErxAZXrGTcOK/2zSV8wiD8NfeeLkONY7YE35DXFc+eUnQ94bx /0JRmmmV0CrsheNEUPJw8Hqc/+u5RhslKyQOjjMex7kT6r6021VOL27gdfxOFWIhA/Tw kYFSslaUACRaCUQkEAk8YP0BRGUhykj98pEWWEaZXXJ4Q60NyWIhPQVAWnpsy5Iu8bvG UzKtXBhbVVRIa8k/HI+bOggeL84XJUMPpf6sFlI4ZdYOBq61WNq6Lr9gxI6kZhdamnfL hJZ95H/lrhuPjV2PitkikzLO5yVTQR2fiYmdJjEO3+9ArEIQwv0nEkwjv+Uqkywsl4un n1iw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UFz6Ngti; 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-204842-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204842-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-44038b41558si21146831cf.512.2024.06.06.10.55.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 10:55:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204842-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UFz6Ngti; 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-204842-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204842-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 DD1811C26C56 for ; Thu, 6 Jun 2024 17:55:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE45919923A; Thu, 6 Jun 2024 17:55:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UFz6Ngti" Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 75A582AD33 for ; Thu, 6 Jun 2024 17:55:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717696542; cv=none; b=L8/IWLFi9sVJWoo6Seyjz8tb0Lm/EXVa01HsZgYgo+HasiU0DCwssBztIz4Trwee+P58Snl+xM3QmobyTvtHnLs7KDWhN2t2kywWZX/TbeCOQmcvAwq3jszMlh7/06caE6Ng7VXr7zpIinaOoQgGxadCYJLYMyKABZI+JzZ8aEY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717696542; c=relaxed/simple; bh=/yCc8X23HbQjK6B0gNq9QaoLe3NQmV9C/0upEheNEK8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=HE+yh4UXPBNgAGHijP8DEU+pv8JLQgM0kLvN/zCyGv+kbi5F23aF9f/p1YUf7BURc967yE0Yx0MoLcX6qB+dr5MmPA+pOrdQiSNh7A89eAa8hMLV9vFb6JUf7XvpQEApBV/JorJy1nZ+62tGp1EzCn1+wUsjr6KswAQcDR0u5Yk= 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=UFz6Ngti; arc=none smtp.client-ip=209.85.128.45 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-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4215b888eabso7115e9.0 for ; Thu, 06 Jun 2024 10:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717696539; x=1718301339; 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=70T0ZceHUGMDadFXNyVFFMOsXxBYbdVP4L874egq+7s=; b=UFz6NgtiyFDHL/4b2Yf9GMkkuglQ2MLasuAKwKAy5njjO6XEfznSZNy3KjVd7tx3JG Y4fHtPEK1TmkbTAApA7qu44OTRc6yBEebUPeyN6wrocRYBw639PiXzclUHEOJWD3NPg7 dO4hGmjJFtu6XRUVvHZnd1aokM5HPkU6pAxLXZEgx+Ahf79/mSmdzfWibaXkV2sMhx31 0ZZ+CoRkSidqVjxBuSo0npDWH2pysrkwUdj3w72bNCd98M9yADu+8U4FOBVhpGce5v3J wbySSU7tE4AakQsnJ7y/MVpDHvdtCrNkPG+4fFzTUIVrOMI6zCdZYHHXqQNqMWtgr9Em dhsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717696539; x=1718301339; 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=70T0ZceHUGMDadFXNyVFFMOsXxBYbdVP4L874egq+7s=; b=Dn9o6aZLI3ZwMKlNp6OzXXF8v9AIuyyq+l41OPBoks8TsFNHI1i4Fd2D2s3I4DAHir BnmgYpTfm1/RzOx3RXi31+yu6j75L1/Jri8sHq34yOatTNhHuLr9yDTqHas6Eqyr0dYU /Srmw5gxarmAvdS/KJseLqfmqu0rJHGHiG01pRq2TR+G1+UWBz/Dgi9yagB+NGDSbF6o FRoPJTyUsjupYZuMWT2BXMlcgUAwIgRG7OSoXPUM0IJxo3YDFxf7LiMirspiR5BABV78 cGgB2b/JpY+QwBUhnjLrCJJIN4Te8KwbeO0IX9ObqZNOa09svTc5Au+Wsvag8wSSrL1A 8PoA== X-Forwarded-Encrypted: i=1; AJvYcCVDgTBT/nZiwjkjBBPJLfPLWuecRTiuI61jXaBKLO/5Plj4Zk95zUZlkPjTn4jAXhidAHIALxnqlytRrPY3MPejRsZwY8m6NYHgwZsw X-Gm-Message-State: AOJu0YzSBhOk9NhAz9GwnGUQw2vO8VOjDN7I1IpopdZRqLBia/QbEA4r gXkhicZb636Ck2HitzNZkejXOML3oxV1CJcn8At3MHduGefNoepTQmIbkdyHPzbCEnOsZwMg29i 9uxcgTweecvfAyZRhvnlwGSeS5M2akUhkX+Uc X-Received: by 2002:a05:600c:1c90:b0:421:5288:8360 with SMTP id 5b1f17b1804b1-4215b327e13mr2782465e9.0.1717696538477; Thu, 06 Jun 2024 10:55:38 -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: Yu Zhao Date: Thu, 6 Jun 2024 11:55:00 -0600 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: Yosry Ahmed , Takero Funaki Cc: 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 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 us= e > > > 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 o= f > > > 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. 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. > 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.