From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (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 6A71B23BCED for ; Tue, 2 Jun 2026 12:59:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780405158; cv=none; b=hXjLwOOcTxtzh4/5+B2H0/eLIfRa6mbYpkOSL9KinHYyX+1vAkzA53VoIGjHgkKOyapLt71i1It04TwKu+QUfG0Pa1CSgdJ9LG/PWU7N4LB5rF9bz5C6Gt5h8zT6i5iYn2nsXPGJup7Y7iDE7vcmAUl+fha1Jb+idlX5Cbo2RgY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780405158; c=relaxed/simple; bh=ToW13RL1iytahZtdKZsnlJ/14piQXhVzw00LDVaaVTI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Eld9Y2O47cz0UntQztvnMcuXz+IQ4aMrCS0Jajz+DcYy7VZkrmadf+5GaumgNE236Y3LaymhHq7lMO7uNJHLPVeYZ+pXHAOJO97xMtEnqTQ7fZxt0eVpv+g1yTPidYEGs3NgM5Fcch0ymgaX7txmkwiLByhd/5HeN27lc7xifYU= 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=Hidy6P92; arc=none smtp.client-ip=95.215.58.187 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="Hidy6P92" Message-ID: <310ede13-dcbb-405b-9a6e-2712eeb8772b@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1780405154; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/SPbQ3DevSf8NYbC/PrJf+Eoeos94edD+J0JXeDRlhM=; b=Hidy6P92voniXSrpzjKCyf+3htZyP4xsLcWu6AhNzsm065bmffyjKDttozP40x7tekUVCr bi/3P1y3LA6oA2nltkBaNxo8pfHuK+3IFkhknBSdUH+LKlNHyyzo6Lc1l2SGaNkvzNzvSx vt/1rqKQ7eaU6sogaRbdxU3T/T/fLbw= Date: Tue, 2 Jun 2026 13:59:09 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 06/13] mm: add PMD swap entry splitting support To: Dev Jain , Andrew Morton , david@kernel.org, chrisl@kernel.org, kasong@tencent.com, ljs@kernel.org, ziy@nvidia.com Cc: bhe@redhat.com, willy@infradead.org, youngjun.park@lge.com, hannes@cmpxchg.org, riel@surriel.com, shakeel.butt@linux.dev, alex@ghiti.fr, kas@kernel.org, baohua@kernel.org, baolin.wang@linux.alibaba.com, npache@redhat.com, Liam.Howlett@oracle.com, ryan.roberts@arm.com, Vlastimil Babka , lance.yang@linux.dev, linux-kernel@vger.kernel.org, nphamcs@gmail.com, shikemeng@huaweicloud.com, kernel-team@meta.com References: <20260427100553.2754667-1-usama.arif@linux.dev> <20260427100553.2754667-7-usama.arif@linux.dev> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Usama Arif In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 30/05/2026 11:52, Dev Jain wrote: > > > On 27/04/26 3:31 pm, Usama Arif wrote: >> Add a swap branch in __split_huge_pmd_locked() that splits a PMD swap >> entry into 512 PTE swap entries. Unlike migration splits, no folio >> reference is needed because swap entries point to swap slots, not >> pages. Each PTE inherits the correct sub-slot offset and preserves >> soft_dirty, uffd_wp, and exclusive flags. >> >> This branch is reached from the explicit __split_huge_pmd() callers >> that hit a non-present PMD: partial-range mprotect / munmap, the >> wp_huge_pmd() PMD-COW fallback, and the swap-in / swapoff fallbacks >> added in later patches when the cached folio is no longer PMD-sized. >> page_vma_mapped_walk() does not iterate PMD swap entries, so >> try_to_unmap_one() and try_to_migrate_one() do not reach this branch >> and freeze=true cannot occur in this branch today. page and folio >> are therefore left uninitialized in the swap branch; a >> VM_WARN_ON_ONCE(freeze) catches any future caller that breaks this >> invariant before the freeze path dereferences page_to_pfn(page + i) >> or put_page(page). >> >> Signed-off-by: Usama Arif >> --- >> include/linux/leafops.h | 6 +++--- >> mm/huge_memory.c | 27 ++++++++++++++++++++++++++- >> 2 files changed, 29 insertions(+), 4 deletions(-) >> >> diff --git a/include/linux/leafops.h b/include/linux/leafops.h >> index 79e04db45bfb..2c0dfce6d0f0 100644 >> --- a/include/linux/leafops.h >> +++ b/include/linux/leafops.h >> @@ -657,9 +657,9 @@ static inline bool pmd_is_swap_entry(pmd_t pmd) >> * pmd_is_valid_softleaf() - Is this PMD entry a valid softleaf entry? >> * @pmd: PMD entry. >> * >> - * PMD leaf entries are valid only if they are device private or migration >> - * entries. This function asserts that a PMD leaf entry is valid in this >> - * respect. >> + * PMD leaf entries are valid only if they are device private, migration, >> + * or swap entries. This function asserts that a PMD leaf entry is valid >> + * in this respect. >> * > > The commentary change can go in the previous patch right? > Will do! Thanks