Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp37891rdb; Mon, 15 Jan 2024 11:10:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IF02iZcK/TQpYUKZsCbnt3GdwTS1xZpMOWUAMMZotPNNF6elnno73NhVe33d4MsP6Ed9+r8 X-Received: by 2002:a0c:9791:0:b0:681:21de:8408 with SMTP id l17-20020a0c9791000000b0068121de8408mr6531711qvd.0.1705345828298; Mon, 15 Jan 2024 11:10:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705345828; cv=none; d=google.com; s=arc-20160816; b=kDJq9E/Dc15GSjAvRrGv0UIi3ucbWZIcx0pX2or58e0NIV71yTJV6EIX+8tVIRb+QH kRiVpzoWrp2No4KUpxt8a4xtXJBXOSi0YkAP6VI0BdjO1Wg0LcAtQFGBkGvXd2tm14B4 W5r6LLYSWxnGxz+8UC7C4ZO7nikEubOtCUhWLKYVxdNtGEMl5N+e9UDPDATTL5+DPSq9 cjj4FP29KChj82+af1JfJZosguHPl2RHiHXW0CAdaPyse0oxYIzMpig2ErQDXR+4bJKE sMP2sUZ8kAvOheOwUoB1RAOUFYchvnX2phV1l0feZM7B66WNofkqOODH12KGJs1ndHpw i+5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:date:from:dkim-signature; bh=G1a7253dNU4a2MSBXxXCeQK7ThZfa8a5dh+VEk56Y+0=; fh=ueywM1R4DGo94Z3QNBN+MHjODFLELr+IVbClhclPpAg=; b=MTn/CHl5ORrIEl9an7Ius9Co+j6zVOcmdazOjHX4ifeqpwAf8ku3OuFk6Siqzy5laW UeTMQYbVCQ88EP80SDtLWED8v3Wm55BUE+TYQCBbXxJcd3LapO0z/0Dd97RYrHmwUeNu 5ycm8owc70Hy7wGZYrry7tW+W1d9NvWwTxiYA6/7xYO+wt+PLRG9GzyHBu8mf4no7OyV DQ5R5CZzGQcy1py5JGGPcrbon3X3/bBMmorggYdOnWX3/1OM4yFAq12WjPDwunancR56 lR0nvT0culd3JVVfain5NW+pm4QvLmKMIkfp1ctFCnISuGKlrIrS8LCRURl31qwWEZC2 6uXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DqDGp8n5; spf=pass (google.com: domain of linux-kernel+bounces-26428-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26428-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u17-20020a0cdd11000000b0067aa32bf679si8278796qvk.347.2024.01.15.11.10.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 11:10:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26428-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=@gmail.com header.s=20230601 header.b=DqDGp8n5; spf=pass (google.com: domain of linux-kernel+bounces-26428-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26428-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 134761C21366 for ; Mon, 15 Jan 2024 19:10:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77BB218ED6; Mon, 15 Jan 2024 19:09:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DqDGp8n5" Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 4970718EBD for ; Mon, 15 Jan 2024 19:09:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-50e7f58c5fbso12183616e87.1 for ; Mon, 15 Jan 2024 11:09:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705345772; x=1705950572; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=G1a7253dNU4a2MSBXxXCeQK7ThZfa8a5dh+VEk56Y+0=; b=DqDGp8n5c539xBNQYEhbeLvq+uxDNQrrSaIhroUpgtfAibuUmIlWPO+LWnaAHCJT35 1UVQCLkcLsk9qRnCpM0ypTmeXykzFXtOc301UHWjaJg2GxSeEJS0dDyQavczJdAfRUvI VNz6RaBEtF2NTnVFJ0Zv7lrAir4XYBGAWdrUq1A7mdNmbgS6TdtlQNhGXZevaGN3DYfq oRbDagTb0xaB+3F4sjO1gLqokbgWehC/Mn59K3iFKFYz3RCoJ7Teo5cT1Cp+rrK/XG4q ulMo38/560zON0f9qOfUSCt3tXKt0YoC6EJ1m4v9nSFNe424EggN7ICrc4VcMKJnw3ZJ NgYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705345772; x=1705950572; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=G1a7253dNU4a2MSBXxXCeQK7ThZfa8a5dh+VEk56Y+0=; b=VxIKXtigDTTgbG2pbKYcjx+hLald55b/KcSYjqwp0g3/CZvwRvIQ9D8sPsiTXtji+N Hbq+1qDPZU9AXgehQKw7aEvUyDQ3Qxtizy7V7niuYqqEoTxJTvuViwe1naNfNmykJWE7 7vIMLEp3nT9bWOSNHptVmj0C7zm00S2MktNQraVQUyUS8u4fHXCLKOxQ/pY7Ux+UkFxR DZi1W/hyezUld9ylRtAQmsbhFy/L7KdipxJwHgDlqVNd5HHYsYvYQi2eksvHGnmK23v7 aTc8ZGQZCbXf51LKBsCMj3E48it6k7gwC7ttIVnm/wbxwilpjSkr0JjGJAV01lNKdsB8 PpCg== X-Gm-Message-State: AOJu0YztANrLWqKycsZN3eHI2GArhJ3gzxhY337p54i+oCMQdPsbAgbE Wohi78XrXANNIhhED6ytdS0= X-Received: by 2002:a05:6512:159f:b0:50e:d5e2:92cc with SMTP id bp31-20020a056512159f00b0050ed5e292ccmr3845250lfb.81.1705345771992; Mon, 15 Jan 2024 11:09:31 -0800 (PST) Received: from pc636 (host-90-233-221-202.mobileonline.telia.com. [90.233.221.202]) by smtp.gmail.com with ESMTPSA id b8-20020ac25628000000b0050eac86fc74sm1541332lff.87.2024.01.15.11.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 11:09:31 -0800 (PST) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Mon, 15 Jan 2024 20:09:29 +0100 To: Dave Chinner Cc: "Uladzislau Rezki (Sony)" , linux-mm@kvack.org, Andrew Morton , LKML , Baoquan He , Lorenzo Stoakes , Christoph Hellwig , Matthew Wilcox , "Liam R . Howlett" , "Paul E . McKenney" , Joel Fernandes , Oleksiy Avramchenko Subject: Re: [PATCH v3 10/11] mm: vmalloc: Set nr_nodes based on CPUs in a system Message-ID: References: <20240102184633.748113-1-urezki@gmail.com> <20240102184633.748113-11-urezki@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: > On Tue, Jan 02, 2024 at 07:46:32PM +0100, Uladzislau Rezki (Sony) wrote: > > A number of nodes which are used in the alloc/free paths is > > set based on num_possible_cpus() in a system. Please note a > > high limit threshold though is fixed and corresponds to 128 > > nodes. > > Large CPU count machines are NUMA machines. ALl of the allocation > and reclaim is NUMA node based i.e. a pgdat per NUMA node. > > Shrinkers are also able to be run in a NUMA aware mode so that > per-node structures can be reclaimed similar to how per-node LRU > lists are scanned for reclaim. > > Hence I'm left to wonder if it would be better to have a vmalloc > area per pgdat (or sub-node cluster) rather than just base the > number on CPU count and then have an arbitrary maximum number when > we get to 128 CPU cores. We can have 128 CPU cores in a > single socket these days, so not being able to scale the vmalloc > areas beyond a single socket seems like a bit of a limitation. > > > Hence I'm left to wonder if it would be better to have a vmalloc > area per pgdat (or sub-node cluster) rather than just base the > > Scaling out the vmalloc areas in a NUMA aware fashion allows the > shrinker to be run in numa aware mode, which gets rid of the need > for the global shrinker to loop over every single vmap area in every > shrinker invocation. Only the vm areas on the node that has a memory > shortage need to be scanned and reclaimed, it doesn't need reclaim > everything globally when a single node runs out of memory. > > Yes, this may not give quite as good microbenchmark scalability > results, but being able to locate each vm area in node local memory > and have operation on them largely isolated to node-local tasks and > vmalloc area reclaim will work much better on large multi-socket > NUMA machines. > Currently i fix the max nodes number to 128. This is because i do not have an access to such big NUMA systems whereas i do have an access to around ~128 ones. That is why i have decided to stop on that number as of now. We can easily set nr_nodes to num_possible_cpus() and let it scale for anyone. But before doing this, i would like to give it a try as a first step because i have not tested it well on really big NUMA systems. Thanks for you NUMA-aware input. -- Uladzislau Rezki