From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lgeamrelo07.lge.com (lgeamrelo07.lge.com [156.147.51.103]) (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 E569936E493 for ; Tue, 9 Jun 2026 16:09:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.147.51.103 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781021382; cv=none; b=EMWOtu5BYruq58lkXF/SF0M0T5zoAR/VzntLS/AzpqlGBL9YZJRDmP2XL5c1X75QfbnC0HQ3GJQIlObgiqacNnbNFwTaUcxNJfvovkaDS8yzI0pkyUzstN9mP/CYBDROQoqn5Ad53g9InYs2fsRtC/PE+RQrj1y86qPOGBdkL2E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781021382; c=relaxed/simple; bh=2z4mxOmmYoZnEr4UL/A56EW1VzchXi5guzJPqKiyBPo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NGsE5+m2v25oucKW/mUwZCG9In0pnS+uU27B1oeKIdOLPAg9DzIOaDvk1R5qtOdHG8qm3DZs5EUJSbP3jKVtelimeJhi16P3WSvxVCgSrracK37746pX9eFtSbVjdQTOCP4kszzTZWFsK4Vd2b+qFaqkqGA/wkJHOiGQsG/yh9E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lge.com; spf=pass smtp.mailfrom=lge.com; arc=none smtp.client-ip=156.147.51.103 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lge.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lge.com Received: from unknown (HELO yjaykim-PowerEdge-T330) (10.177.112.156) by 156.147.51.103 with ESMTP; 10 Jun 2026 00:54:37 +0900 X-Original-SENDERIP: 10.177.112.156 X-Original-MAILFROM: youngjun.park@lge.com Date: Wed, 10 Jun 2026 00:54:36 +0900 From: YoungJun Park To: "Ritesh Harjani (IBM)" Cc: linux-mm@kvack.org, Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Andrew Morton , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , David Hildenbrand , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Sayali Patil Subject: Re: [RFC 0/4] mm, swap: Enable THP SWAP for PowerPC Book3S64 Message-ID: References: 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, Jun 09, 2026 at 06:49:30PM +0530, Ritesh Harjani (IBM) wrote: > On PowerPC Book3S64, MMU is selected at runtime, so macros like PMD_SHIFT are > effectively runtime variables in the Book3S64 code. THP swap code uses these > macros for e.g. to size some of its array data structures based on PMD_ORDER. > This patch series makes that usage dependent on the runtime variable. > > Sayali did some performance runs of this on Book3S64 with Radix and it gives > 40-50% performance improvement. We also plan to run it with Hash, will soon > update the results. > > Note that this patch series is based out of linux-next (next-20260608). > > Ritesh Harjani (IBM) (4): > include/linux/swap.h: Remove unused leftovers > mm, swap: make SWAPFILE_CLUSTER runtime > mm, swap: make SWAP_NR_ORDERS runtime > powerpc: Kconfig: Enable THP_SWAP on Book3S64 > > arch/powerpc/platforms/Kconfig.cputype | 1 + > include/linux/swap.h | 17 +--- > mm/swap.h | 5 +- > mm/swap_table.h | 6 +- > mm/swapfile.c | 132 ++++++++++++++++++------- > 5 files changed, 106 insertions(+), 55 deletions(-) > > -- > 2.39.5 > Hello! Instead of making SWAP_NR_ORDERS fully runtime, could we set it to the max PMD_ORDER possible on PowerPC Book3S64 as a compile-time constant in the swap.h ifdef block? (My assumtion is PMD_ORDER max not too big.) I think the general runtime version adds cost. It impacts all other archs. percpu_swap_cluster needs a runtime alloc, the si/offset and nonfull/frag arrays become separate pointers, and some accesses get one more indirection. And for nr_orders=1, the allocation itself is just waste. With a compile-time possible max constant, the only downside is some acceptable amount of wasted bytes per CPU / per device on Book3S64 (the unused entries in the swap offset cache and the nonfull/frag lists), with no perf impact. the perf improvement comes from THP swap itself, right? Other arches see no impact at all. patch 2 looks fine as is. SWAPFILE_CLUSTER backs much bigger per-cluster arrays, so runtime sizing makes sense there, and it looks like no impact to other arches or the current code. Thanks! Youngjun Park