From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04BCC386439 for ; Sat, 30 May 2026 08:06:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780128385; cv=none; b=urQSSOtOBQBSmVvRY0OCJak7Q4NMHhSlfjG9nj7+i/vsQ1OjZI4TIcfF5aXr28VYes4knLe0wKS2swS3VROp4nGV8duv4Cm+hfaZ/20XTSpcLFn2QxbyilyUFiSkNBbfXrqESSNGUVLo0EgyOxdKhQmCNrA+uSEL9Uh9bFdfLnI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780128385; c=relaxed/simple; bh=7vvUY2bY5cG+jp+gcaFB5Zhg06G0O7MsBrswcR2irq8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=fzrzaBx2O3FUI5+w62DLLnfH2Z+xjWOMF2WoIhkDVRBfPIMVeDK67iP+OYkk3E7gEETTO4viRh+fXJx8hPf02QHPU3ce80KDXTnegPlGRsd9zgPmRrfxKz7Me5qlpMC8tZ39OH1YjRkJzCUQZdX0XfblLcjMGaBrKkKDLMdn4bE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=APRKAkgW; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="APRKAkgW" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9CB66271B; Sat, 30 May 2026 01:06:13 -0700 (PDT) Received: from [10.164.11.56] (unknown [10.164.11.56]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 73D983F632; Sat, 30 May 2026 01:06:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1780128378; bh=7vvUY2bY5cG+jp+gcaFB5Zhg06G0O7MsBrswcR2irq8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=APRKAkgWSKPSuPTFIF+KEaqz95wPFE7kGyX/nSFRmUisdDBCfsGwaAI+EDGf3s1Hi YeorJnnZPT4b7qayiD/+hPeanD5Bk4safhUvvrBMhAOPagqnaDghD4eZCbaf3wB5Te eLvStI5rvSBhFGJVfu56lUvYWYK1FuZCPO4j8Q9g= Message-ID: Date: Sat, 30 May 2026 13:36:07 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 05/13] mm: add PMD swap entry detection support To: Usama Arif , 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-6-usama.arif@linux.dev> Content-Language: en-US From: Dev Jain In-Reply-To: <20260427100553.2754667-6-usama.arif@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 27/04/26 3:31 pm, 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 > THP migration (x86, arm64, s390, riscv, loongarch), mirroring the > existing PTE swap exclusive helpers in each arch's pgtable.h. > > Signed-off-by: Usama Arif I realize that CONFIG_ARCH_ENABLE_THP_MIGRATION is a misnomer now. It really means "does the architecture support PMD softleaf entries?", ut has got nothing to do in particular with migration (I think?) because migrating a PMD THP without splitting is always a win and no arch, despite having PMD softleaf support, will switch off this config. So with that in mind, probably rename this to CONFIG_ARCH_SUPPORTS_PMD_SOFTLEAF? Because it is really confusing to see swap entry support being added only to the arches which support thp migration.