From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (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 22F093D3B3 for ; Mon, 1 Jun 2026 15:44:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780328659; cv=none; b=d72j3h+KCI4Pl75hSfEZM7kfZRuaHFUfdovbkNCWuFztoH18/uNwYIeRiv9ATTtb9zPbyvsNG6NPC4xg7cN+aPy+mHM5YUg7dGurqdbk1+q+f6l0d7+9LtMy/FXo0/Lo1huDqeoSkqKzjzfGUdJ8o/zaBilrJdJ3jlOZsZ/jtGY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780328659; c=relaxed/simple; bh=W3B8Q1Oe4jJQHUdWeQDYRllURJHI0NRG3tSnC3rI3ws=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=d1YJRUy48eiubzIxBsJBWgnvDFENZBRvcQTjFT0GBEYxQiFfnEflzT2/Tl/D3Jeu0WtPYFQNr4znt6VL3n5QdUPg19ffLaSisz0FgEsekAWE5FhkVrXgzrrNu+iOpjt4KTf0Ps1HEfEMlt5KpjeMmb2LWii1uIxLWI79F/lSVf4= 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=SW2HVAvw; arc=none smtp.client-ip=91.218.175.186 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="SW2HVAvw" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1780328656; 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=mgxgY8d+G/6RTOQ+BJPpqzlDf4UdD5DQTydgCd5fyJg=; b=SW2HVAvw2yZu4I9MOOCod0UfssJYy4pt1A9hpEgVLqAe2/h1H9PZfGvrqmQ/pQbWApbAVx B2oofFQxFPT+jwLRowiWeqH/MqwmXVsj9A2gLQChaPYxKS5mCUEsoS/sy7zrgP4Ss71B8M J/USgdBKjwLAy16nGeLo9BqWWNTSL38= Date: Mon, 1 Jun 2026 23:43:56 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [RFC PATCH 1/3] mm: make persistent huge zero folio read-only Content-Language: en-US To: "David Hildenbrand (Arm)" , Dave Hansen , Xueyuan chen Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, catalin.marinas@arm.com, will@kernel.org, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, ljs@kernel.org, ziy@nvidia.com, baolin.wang@linux.alibaba.com, akpm@linux-foundation.org, ryan.roberts@arm.com, dev.jain@arm.com, yang@os.amperecomputing.com, jannh@google.com, linux-mm@kvack.org References: <20260527035607.14919-1-xueyuan.chen21@gmail.com> <20260527035607.14919-2-xueyuan.chen21@gmail.com> <4e0696ee-895c-486d-aacc-71146f0e9047@intel.com> <929875a2-9e94-4dbc-9c98-b342ccc3f4e2@kernel.org> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: <929875a2-9e94-4dbc-9c98-b342ccc3f4e2@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2026/6/1 21:49, David Hildenbrand (Arm) wrote: > On 5/27/26 17:55, Dave Hansen wrote: >> On 5/26/26 20:56, Xueyuan chen wrote:> +#ifdef >> CONFIG_READONLY_HUGE_ZERO_FOLIO >>> +bool __init arch_make_huge_zero_folio_readonly(struct folio *folio); >>> +#endif >> >> All of the #ifdeffery needs to die, IMNHO. >> >> This function is also a bad idea. There is nothing "huge zero" specific >> about it. It takes any old folio and tries to make it read only. >> >> Just make it: >> >> bool __init arch_make_folio_readonly(struct folio *folio) >> > > I'm not sure whether we want a folio-based interface, though. > > This will likely be the only folio (that will actually have a "struct folio" in > the future) compound page we'll ever mark read-only ... whereby I'd guess we'd > want other non-folio pages to be read-only in the future (encryption keys etc, > maybe?). > > So I'd instead use a page-range based interface or sth like that. Just to check, did you mean something like: bool arch_make_pages_readonly(struct page *page, int nr_pages); ? So it can work on pages as well, not only folios :)