From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.226 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796267703; b=zR/UogAqsqKefMRpntlhXnLLZp2AdOaV8zCKPwpXzrXU+DlYrMW2rPFAFenkaxmeOsRZ iIFezKGoh/B+bL128CZcQ/ZaN8bcp67NCJChA/g03t9WfunJxcZhJBzTY+CP9ZLUFvfVM iNn0tjCnID5xy4F/lLIdmYSjVPNlmIto7emwY5T/IZRxYdAfdGzxat110tKZKwP9g7/p8 i0Xf0zWTR6x0qAZgsPNwz7qNwO9q7gcKZjgU5Hinqg/b81maDAWM2A/YriyOi8y5czjRf 7QxrG3UE+MresuYwjdwaGGpMXYAqubnKcksfyQWznK1P2IPXjn5/lMcr0xXyGlb7oOg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796267703; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Content-Type:Mime-Version:Subject:From: In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References: To:X-Mailer; bh=/nQWXXk+wjHHxlnVHtb2MEz0qUmRq45jB7dqP6+rpkY=; b=GbMHzlUSM/mEJmUGWb7sBPVOI+nR4bHbdgXpyQC6CJfL3Vbs221GwxlPU23LqmFtFVVH f2GqVptRK9B748g/oFJ4ub/x34xEr8txu69OH+/+odNSaV4GNAQjcCiqR1bCarfMMd+oV 5dPvZS4WE5zFeUHwhVCKxTSb10w/VQrTRdRUHvRm5JxsLIhLKGxBUwAaTO0QtkH801vI6 b6KaL8csTQqkGubxlVBNFZ/2VFcSNwJW8TDbajqjjvm/PHjMFtrAGSUUYr2jfmQS8YikF o4mDpRQYhSwKyelv0vQ6GsjmynPV9oWdAsbTbkiq5Hi98wEn/AHV/1wrKPGsq3ZULJQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=ChWFMtM4; arc=none smtp.remote-ip=95.215.58.226 Received: from mta1.migadu.com (out-226.mta1.migadu.com [95.215.58.226]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41341606A332 for ; Thu, 3 Dec 2026 03:15:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 41341606A332 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, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=ChWFMtM4 X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=CMMY9FVNtW3JeEL1DPoShoMZp4vzhYmU7Uteq0wremk=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796267700; v=1; x=1796872500; b=ChWFMtM4Y7lUQknobUxtA4m9ftSXFENfaO0MX/wYt0RPSWptyjIGYctkVAznYj7RWpy80+VC x5F6CXbSEG9/qKHZnaduTVKh2OuVFYVq/vkwX5URsh5TFFZRqCDszhw4pbvyKvPVuYwsYS9jLOr FfoyFe4Ms/iM/7wTp8438bss= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 9f9d45ed4135bf45; Thu, 03 Dec 2026 03:14:59 +0000 X-Mizu-Trace-ID: 9f9d45ed4135bf45 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset=us-ascii X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3901.200.71.1.16\)) Subject: Re: [PATCH] mm: use softleaf_migration_mkreadable() in change_protection() From: Muchun Song In-Reply-To: <1b920241d08ed3c39c2cd19a5507529bb3af95a2.1796187429.git.chris@chrisdown.name> Date: Thu, 3 Dec 2026 11:14:41 +0800 Cc: Muchun Song , Andrew Morton , Oscar Salvador , David Hildenbrand , Zi Yan , Baolin Wang , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Usama Arif , Kiryl Shutsemau , Lorenzo Stoakes , Suren Baghdasaryan , Vlastimil Babka , Shakeel Butt , Pedro Falcato , Jann Horn , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Tal Zussman Content-Transfer-Encoding: 7bit Message-Id: <9E9DEA08-88A6-4C5F-AED8-B2DA1F8B6472@linux.dev> References: <1b920241d08ed3c39c2cd19a5507529bb3af95a2.1796187429.git.chris@chrisdown.name> To: Chris Down X-Mailer: Apple Mail (2.3901.200.71.1.16) > On Dec 2, 2026, at 12:59, Chris Down wrote: > > change_protection() downgrades a writable migration entry to a readable > one in change_softleaf_pte(), change_non_present_huge_pmd() and > hugetlb_change_protection(). Each of them open codes the same choice: > the new entry is readable exclusive if the folio is anonymous, since a > writable anon migration entry implies AnonExclusive, and plain readable > otherwise. > > PAGEMAP_SCAN's write-protect path needed the same downgrade, so > softleaf_migration_mkreadable() was added to leafops.h for it. Let's use > it in change_protection() too. Each site still handles the soft-dirty > and uffd bits itself as before. hugetlb_change_protection() only looked > up the folio for this choice, so its local goes away. > > The other places that choose between readable exclusive and readable > migration entries, such as try_to_migrate_one() and > __split_huge_pmd_locked(), carry over the exclusive state of the page or > of the old entry rather than downgrade a writable one, so they are left > alone. > > No functional change intended. > > Suggested-by: Lorenzo Stoakes (ARM) > Signed-off-by: Chris Down Nive cleanup. Acked-by: Muchun Song (ByteDance) THanks.