From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (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 BBC353CB2FC for ; Wed, 3 Jun 2026 10:46:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780483608; cv=none; b=YEiY6yXDSH8ly+vtfzy3sXzON4i7AeFhhZOdSm54ZFS+TsyEaR/iqr6aTB0QB1JhlJYupfVo63lKdbRd+z1sg7fY1wlpRMlOYwnMR9UaODJqKbGmmX8Y4P6uPKlnUHaXUaob+EY7KVTwRTn+GHPLHSTGXaFs1JJTI4pO9+/t9iQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780483608; c=relaxed/simple; bh=6kmEtJI0IQeR2+l7cj0oJFD5KNCBUsUnHQ3GFjk0zTk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=csuVL7Y/TpoYErbdsW9QCrZyVSdv480x40iDvsl+x7MexxOQoMLMmxxrX1ecRQbAzSxBEdYWwJP223luf+r4CDPQhEfRx+VTbW0ncJom7cj1DomXtzx61qHrkZgZqcQ1NYLQSZZgHA+e/nTNKIIlJSsVnq+xE0bCjRiL9atIYcQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=XXGF0ws4; arc=none smtp.client-ip=95.215.58.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="XXGF0ws4" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1780483602; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=eX4TxU9rB0+/Bivm6trS3GNuZ9v16Mi+xd4AjbxmjDM=; b=XXGF0ws46yyClAQ65lfsa2iDd8t9S9FUgM/ihG6ET15TzjyydYQOLLE/QG60SWFONV+T2F /jD5/kRbsEKB9F1vZN4T/dpcgNZp8AfInoTdT23j3rFIcl888YGD0YX7Qh09yW6LLzJ9vY Gq6uLBa1eOm34vN+812305wSvgki2Mk= From: Lance Yang To: akpm@linux-foundation.org Cc: rppt@kernel.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: [RFC PATCH 0/2] restore large page mappings in direct map for secretmem Date: Wed, 3 Jun 2026 18:46:22 +0800 Message-ID: <20260603104624.36390-1-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-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Hi all, 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. This series adds an arch hook so secretmem can ask the architecture to try to restore large page mappings whenever secretmem restores a folio to the direct map. Thanks, Lance Lance Yang (2): mm/secretmem: try to restore large page mappings in direct map x86/mm: restore large page mappings for secretmem arch/x86/include/asm/set_memory.h | 2 ++ arch/x86/mm/pat/set_memory.c | 27 +++++++++++++++++++++++++++ include/linux/set_memory.h | 6 ++++++ mm/secretmem.c | 12 ++++++++++-- 4 files changed, 45 insertions(+), 2 deletions(-) -- 2.49.0