From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF3D0C3DA79 for ; Mon, 15 Jan 2024 19:09:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 746C06B0099; Mon, 15 Jan 2024 14:09:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F6736B009B; Mon, 15 Jan 2024 14:09:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5BF2C6B009C; Mon, 15 Jan 2024 14:09:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 491096B0099 for ; Mon, 15 Jan 2024 14:09:36 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1FF6D40404 for ; Mon, 15 Jan 2024 19:09:36 +0000 (UTC) X-FDA: 81682484352.18.C4E3DCD Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by imf24.hostedemail.com (Postfix) with ESMTP id 372A0180018 for ; Mon, 15 Jan 2024 19:09:33 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ISE2VeWC; spf=pass (imf24.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.50 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1705345774; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=G1a7253dNU4a2MSBXxXCeQK7ThZfa8a5dh+VEk56Y+0=; b=CmUsLdNxBsVKE+udTdykSdd+hVbwtcjet5yeNUOoIpmuw1ej2VMQKZ6/paz88eInIOusA9 psT9Asrvorje84h6Xxx3y4ww+c+mtPw+cCo742sPSZmS0kf8SyhHksPwOltdIaGoJ2suR9 ZpNmjvraCwEErjn5KNlkNYLnJc/NNUM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705345774; a=rsa-sha256; cv=none; b=VY2ECxMp2olsAHe6frihe0sfuvkkdabfY+0YWJFI67jzpdXKML+YSI7KLNI68ntXKOnzB7 GxfakAMDccGpB0YmKKSVCs9+IGPk9C4Nwe7j+G7L7PNLgUTZDrcHpBwWSr/F6GTBrmnQWu RQlbn4c3hyRHFsmyV9nxI5wlFapfWeo= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ISE2VeWC; spf=pass (imf24.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.50 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-50eac018059so11343234e87.0 for ; Mon, 15 Jan 2024 11:09:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705345772; x=1705950572; darn=kvack.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=ISE2VeWC4lMYxZszrXQgZSvGVb42t7jdAiph3NxpMrNlgB1w3NHXSZ/aW9Q4JF3+G3 SEgKyXCKgBtw7YAzUY5UnTnjLIa3kAoN1E6w/u613f2+edRREJs2R+Wzhmj1eLNA+9z1 ucf7jtF6K4ys4qc1QY5CubXkH2ITbDAYxSpZYoHGvZ2J2jd9beVZW07umZQssKbsws0l Um4LcfnuQdH7SQbrEHoX1XJml3ny8YqWD5OEFTvap3EFOUbDJDY3OFF4TzkG/zun9pXg vgFarAcLWBCGdqMiCS7B1+A+12HG8yrGuQp+56ilkvSEPg0igXGljHKjiMSCCYmvArT1 rUog== 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=FmGFtQxzODcgIwtYb+qvJuN+r4kgpeP0v1zVvpWiXK3xo9BbenyCcl+rKU1d02/Li6 yJLjh7rzMHxtf/gySbPxI1foKP18OWCVAPVo0E1fcJ24kcsyT0XwV9SIpiQSyiDlXJy3 kROb3CmdUBehPVz4t73stGFwGNP7zxEBOwHP7WdsDcyVadi7OUCm0hkk1F9PJW6TDVlc CD1f0KpgEN7iCElX9HafM3px320ZX+isIxRNkLfJjq3JRwmiY3/Ok97eY2TxGOfalIJd 4I+Uy2XrJb/a4a/xgC0ny28l/+UYoV8EPc+NEu+dYZCaXPBijZFc/5BMugZYwDrQyjs/ jmDw== X-Gm-Message-State: AOJu0Yxf3/XA/j4n8j5jCRNG+g7EuPLSo11wEn2C0ewhSBpDFloV2T1U gcmfpxMLiZvZrRo0rD5aC0M= X-Google-Smtp-Source: AGHT+IHr3cFy9mv+SiGi6cqh5ydwfEFrWo8HMNEimL88GvtST76NarrqSXvtGV6Qd1FEkIFCzsZn9A== 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 372A0180018 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: k46qh3da74b4x9xihhyfaho654g56w1y X-HE-Tag: 1705345773-717637 X-HE-Meta: U2FsdGVkX185ZhsNErOmPjdqmUX2GiDp7fCJIWclU5hKEhWXb2s8oBBEXfvwSKUFuQ9w2aOfm3GZFTkuwFJThslfCzuKt4Y7NCQa8/jo0/MaRxN4VgM9G/ZObOmJasKxpNvqWkcnpFC8QFJHjfZgbH+zkBMQ6paNVZOlg5wVMmhjiyp4M5fJ39Sy3yDf+387p3B76drIFS/HhkC9E4pJkzn/AK4Cax49xBGLLDHaEN7xLuusjSJiRNwcfyv4x2XDfiNWSp5l/IDFZCd67ReZZiJckuFnRll/9MU+sciX9EHhPNvyG9rnh4IoCUYJDguWbl84MI0CnldY9s4S91/vn+L9+7Er64FHhKaMapgcMm+WqEW/2Yo5JhAc5MFkMPWISnC72BFCcK9YYVPy6n0N2uIyXuPbYygHcZeAEMDGi14sBHhQUTSZgHdSicqek6b5SKeT59ETh1C7nkXgkbdfIGk+oY7e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op: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: > 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