From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 317D834F491 for ; Fri, 27 Feb 2026 20:28:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772224139; cv=none; b=n9GLz8bhRIk2gs5GAl9mEmDj9rxd2N51LUB0yjXPGhOrZObYYbVUl2sECidoGOFZLIFZsWbfdJKhQaQC2xjaf4q5ewUJkU8RxR45w6CIl0wtBODXdyz9/+hDtIDhO5oePlPpKbf1ZOb/ygXWHxclSBOh+Bav9KHl74oQ0jGAedo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772224139; c=relaxed/simple; bh=lWZrAMHtw5UzETwtNfpRyUNcmqJTeG/3y3lEgOPYwFE=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=Evgkqp4p5OAz0eswfz4TLJ1YtQV/Yju/oCFDW3lWmTmJQp4JYwAY6YdGoMn4f+Btj0W1yCjlk1CjRjGtqARpLX/xjXAzB1+g0Q4Fuul2qr0clYMLR0Xit9ZafbDxTbsOkMZnPLCRIsSiOWiuBgSpsgYc9ctBjWRkbNTgccHxjVs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=w1HTD9m4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="w1HTD9m4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75707C116C6; Fri, 27 Feb 2026 20:28:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1772224138; bh=lWZrAMHtw5UzETwtNfpRyUNcmqJTeG/3y3lEgOPYwFE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=w1HTD9m4xQJi4FjFB+OIdrFkPGm2WlFfCHgcYBPv4hKlcT8DILY7zKXKD7HqGG7cl TiMrdS9wDqPW6m3wnxKWld3vmh4HM7BoW1J+7YDGPNYXiV/yidBEJJnMm1ra4suURX R5NPnZEUdsyFcnh/YN+5RJth09f2buKgejmhCj98= Date: Fri, 27 Feb 2026 12:28:57 -0800 From: Andrew Morton To: Benjamin Lee McQueen Cc: david@kernel.org, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@kernel.org, rppt@kernel.org, surenb@google.com, mhocko@suse.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/vmpressure: scale window size based on machine memory and CPU count Message-Id: <20260227122857.dca67a5f281e39a3e78acc74@linux-foundation.org> In-Reply-To: <20260227163333.6394-1-mcq@disroot.org> References: <20260227163333.6394-1-mcq@disroot.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Fri, 27 Feb 2026 10:33:33 -0600 Benjamin Lee McQueen wrote: > the vmpressure window size was recently fixed at 512 pages regardless > of machine size, this patch makes it scale based on the machine memory > and CPU count. Why? Presumably the current code is causing some problem - please fully describe that. > --- a/mm/vmpressure.c > +++ b/mm/vmpressure.c > @@ -32,10 +32,20 @@ > * As the vmscan reclaimer logic works with chunks which are multiple of > * SWAP_CLUSTER_MAX, it makes sense to use it for the window size as well. > * > - * TODO: Make the window size depend on machine size, as we do for vmstat > - * thresholds. Currently we set it to 512 pages (2MB for 4KB pages). > + * Window size is now scaled based on RAM and CPU size, similarly to how > + * vmstat checks them. > */ > -static const unsigned long vmpressure_win = SWAP_CLUSTER_MAX * 16; > +static unsigned long vmpressure_win; > + > +static int __init vmpressure_win_init(void) > +{ > + unsigned long mem = totalram_pages() >> (27 - PAGE_SHIFT); > + > + vmpressure_win = SWAP_CLUSTER_MAX * max(16UL, > + 2UL * fls(num_online_cpus()) * (1 + fls(mem))); > + return 0; > +} > +core_initcall(vmpressure_win_init); Whitespace is odd.