From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (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 5427832E6BC for ; Thu, 9 Jul 2026 13:51:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783605064; cv=none; b=q4iazVllm6UmaSdI3yjAq7e3aeLuDk2y7JF0RPIas17IN37HTH80/Tqx1nANHt3ecIduk00eyDV9JOAlDvhmC3Zx3pLnlQSl9m94RBhmjQWfv9cmpOCqaEpY7KSzPhbe5U0LxlL6wIdLB4yLk/8XLFt6eehH+gNFYafgZvBHUiA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783605064; c=relaxed/simple; bh=mYig2I2oiMiEyBwUDppBL6mPoWNIwjxPU0LSqEHoIL4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tSyoxIKlqx6z7B8HsPlDvfo9Nyzyy5Q02VYrrDAfpz7cdDaFTwvZu80Loccuiu3Cxl1TzZjFXvLZpBhngnveMos2f9ZHfSNiRE+NKviIV5cMYlVgplZublf2A7RdGI0nSx/ak+dBvMi3NJX8KKifcSuki1HcuKowaZi4Krnvqf0= 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=qj3MKYul; arc=none smtp.client-ip=95.215.58.189 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="qj3MKYul" 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=1783605060; 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: in-reply-to:in-reply-to:references:references; bh=z8FqW5eq3Uh1W5agsXYXom0eXyZ/LkbEOhFOOkLyqNU=; b=qj3MKYulS0/NJ/Qjk8zhEIgCr9AW0b51sFXof////YFtj5/yXTLY4yyzdVD1+/8HM/hfFX 3KOoV5n2sVnAjg3GVW2moiIW/UcY/2XiWIKzaUzuBzVYyPCsOS8yDqeFxjEiYGcGgV66ta CLG9sXAFewOyZ2U5Vgpi+8YvYKSCbX4= From: Usama Arif To: Usama Arif Cc: Andrew Morton , david@kernel.org, chrisl@kernel.org, kasong@tencent.com, ljs@kernel.org, ziy@nvidia.com, linux-mm@kvack.org, ying.huang@linux.alibaba.com, Baoquan He , 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, dev.jain@arm.com, baolin.wang@linux.alibaba.com, npache@redhat.com, "Liam R . Howlett" , 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 Subject: Re: [PATCH v3 01/11] mm: add PMD swap entry detection support Date: Thu, 9 Jul 2026 06:50:49 -0700 Message-ID: <20260709135050.2910286-1-usama.arif@linux.dev> In-Reply-To: <20260703173903.3789516-2-usama.arif@linux.dev> References: 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 On Fri, 3 Jul 2026 10:38:18 -0700 Usama Arif wrote: > Currently when a PMD-mapped THP is swapped out, the PMD is always split into 512 PTE-level swap entries. To preserve huge page information across swap cycles, later patches will install a single PMD-level swap entry instead. This patch adds the infrastructure to detect those entries. > > Teach the softleaf layer to recognise PMD swap entries: pmd_is_swap_entry() detects them and softleaf_is_valid_pmd_entry() accepts them as a valid non-present type. Clear the exclusive overlay bit in softleaf_from_pmd() before decoding, matching how soft_dirty and uffd_wp bits are already stripped. > > Add pmd_swp_mkexclusive(), pmd_swp_exclusive(), and pmd_swp_clear_exclusive() helpers to each architecture that supports PMD softleaf entries (x86, arm64, s390, riscv, loongarch, powerpc), mirroring the existing PTE swap exclusive helpers in each arch's pgtable.h. Provide generic no-op PMD swap exclusive fallbacks for architectures without PMD softleaf support, matching the generic PMD swap soft-dirty fallbacks. > > Signed-off-by: Usama Arif I forgot to format the commit message before sending this patch, sorry about this, will fix in the next revision.