From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 3F61544B68D for ; Wed, 3 Jun 2026 10:59:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780484389; cv=none; b=Lim5HY8+UnCnQaDjvaEqBcMu75qxrcKy3lGIRoK5jHLP++ddoq6WkElFx3MVhVZ2vQnL+MOziy31iMDGgbnTqsJ/wiBQb3wd5WQhRGvHDYH8jDVCC/u/raPdP5LM6foJUY6BpD5NPc6M1MSN7cbySUXHzyfbGORJabjDkttnTFU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780484389; c=relaxed/simple; bh=KdRsgyoH4MAdMUVOhTWSuoD4R3LwYBg3/SFD0wwAc0s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EVVYS+ETScal2a1A+qOpBYDIuXTU9BDgAYhgvD33wxOPwb9LjP/lZ+p+JHzvdq0xPeuM9tr2V8Olb6EGFDfKNiDEPng+DmmstzIyWRmj5uK8dGsGpl9lH9zZs0wMJGFFVVuEga7gjHh/zS5GPs33+kSFGgxqUMjN4Oq6smmbg08= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LbOOrg6U; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LbOOrg6U" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5229C1F00893; Wed, 3 Jun 2026 10:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780484387; bh=LNk5vW4s69I2K0c0Yz4QAV+UHhsLI+rVPezuIvq54J8=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=LbOOrg6UPzlmVVhpLbmmBadHDKyaV6em4iZXtTw/bwi9OxEB/Z2kLznZZfoyaIpIn Pp63NWCW+s6iI/9BDWhG5OTJzxNYlVOrc8cF+gD4WtKa2p/hf1qgnWnVtiWqNzf25r iZ/hMM5i/iPJwr0aJr/ri1fXCtCP+bKeYXTCG272+P3vQquYYR5YJlJeTjnl/+2F3h JVnCBpNeX19CeVh6ic0bg7J1PiQCesrbEcvVJ3F9nt6uosWydyaCR9ACG9t7QYTqj3 ZP5uY/607EeWe/UU6/6jum7YQM3r6hPySVDYKrEMv1Ayk3Y5hEhQ0j+U3byptZjwG4 7vilOYdwoBoNg== Date: Wed, 3 Jun 2026 13:59:39 +0300 From: Mike Rapoport To: Lance Yang Cc: akpm@linux-foundation.org, david@kernel.org, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, luto@kernel.org, peterz@infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, xueyuan.chen21@gmail.com, ioworker0@gmail.com Subject: Re: [RFC PATCH 1/2] mm/secretmem: try to restore large page mappings in direct map Message-ID: References: <20260603104624.36390-1-lance.yang@linux.dev> <20260603104624.36390-2-lance.yang@linux.dev> 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: <20260603104624.36390-2-lance.yang@linux.dev> Hi Lance, On Wed, Jun 03, 2026 at 06:46:23PM +0800, Lance Yang wrote: > From: Lance Yang > > secretmem removes the pages backing secretmem mappings from the direct map. > > Removing one base page from the direct map can split the covering large > mapping down to PTE mappings. Repeated splits can leave more of the direct > map mapped with PTEs, meaning more TLB entries for the same range and > potentially more TLB pressure. > > So let's try to restore large page mappings whenever secretmem restores a > folio to the direct map. > > Tested-by: Xueyuan Chen > Signed-off-by: Lance Yang > --- > include/linux/set_memory.h | 6 ++++++ > mm/secretmem.c | 12 ++++++++++-- > 2 files changed, 16 insertions(+), 2 deletions(-) > > diff --git a/include/linux/set_memory.h b/include/linux/set_memory.h > index 3030d9245f5a..ad2fa414a22d 100644 > --- a/include/linux/set_memory.h > +++ b/include/linux/set_memory.h > @@ -58,6 +58,12 @@ static inline bool can_set_direct_map(void) > #endif > #endif /* CONFIG_ARCH_HAS_SET_DIRECT_MAP */ > > +#ifndef arch_try_collapse_direct_map > +static inline void arch_try_collapse_direct_map(struct page *page) > +{ > +} > +#endif Did you explore what would it mean to hook collapse_large_pages() into set_direct_map_default_noflush()? -- Sincerely yours, Mike.