From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (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 995E9377567 for ; Fri, 26 Jun 2026 15:08:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782486538; cv=none; b=XVNwvCpGcALejpe2PF0Dr1SGoBNiffjoKZYgPVSzNegY9L/1IG/IZ4JY5P9CpikBjpqPd6ix8pKLwjqSzxbFu+JB2UNkcKmCzrBuBPPOb76mnLQZTfpwcq+pJCwFRBCV92mkUrJx7RkMutuByLjFHcIlDeVq/DTZNPD90FiFRxs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782486538; c=relaxed/simple; bh=W9StKkQ0/yj07eWoElZiv+n2VxDoLxnR18N0r893Esc=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=FXi+/E58zSzsEFVoSlm6jlHLRwu3vDoR2LgBMA1mHMQa7Tfs6g171FelDNIvQuUp8qikX0hr94LJqnoqlbBocZCcTji8X5PlsT1LhhvskRGHb/KQKF75xCCxq9igQzY7hQXICmgDKkXq6QpcFsTT2dhqNgJ2rNdx5C3dCT8Lito= 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=BPvNDeEl; arc=none smtp.client-ip=91.218.175.184 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="BPvNDeEl" Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1782486531; 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=W9StKkQ0/yj07eWoElZiv+n2VxDoLxnR18N0r893Esc=; b=BPvNDeElvRZEMwzggouWII2tofymA3pxu+5JfmGwK7CJp2impsOKKN+WsSGMrtCbjeGBPp NozIkXctwbMzmWJYZfWlevw7VPXWSaOnPydN+auEoQa0orwMQ/6weJ5g1FizLIV7FLvrOU M1Cmc9YYM8i84hgILpAHMIQo3kf7m7E= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 26 Jun 2026 15:08:42 +0000 Message-Id: Cc: "kvm@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mm@kvack.org" , "bpf@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , "kernel@xen0n.name" , "linux-riscv@lists.infradead.org" , "pbonzini@redhat.com" , "corbet@lwn.net" , "maz@kernel.org" , "oupton@kernel.org" , "suzuki.poulose@arm.com" , "yuzenghui@huawei.com" , "will@kernel.org" , "seanjc@google.com" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "luto@kernel.org" , "willy@infradead.org" , "akpm@linux-foundation.org" , "lorenzo.stoakes@oracle.com" , "vbabka@kernel.org" , "rppt@kernel.org" , "surenb@google.com" , "mhocko@suse.com" , "ast@kernel.org" , "daniel@iogearbox.net" , "andrii@kernel.org" , "martin.lau@linux.dev" , "eddyz87@gmail.com" , "song@kernel.org" , "yonghong.song@linux.dev" , "john.fastabend@gmail.com" , "kpsingh@kernel.org" , "haoluo@google.com" , "jolsa@kernel.org" , "jhubbard@nvidia.com" , "jannh@google.com" , "pfalcato@suse.de" , "skhan@linuxfoundation.org" , "riel@surriel.com" , "ryan.roberts@arm.com" , "jgross@suse.com" , "yu-cheng.yu@intel.com" , "kas@kernel.org" , "coxu@redhat.com" , "ackerleytng@google.com" , "yosry@kernel.org" , "ajones@ventanamicro.com" , "maobibo@loongson.cn" , "prsampat@amd.com" , "wu.fei9@sanechips.com.cn" , "mlevitsk@redhat.com" , "jthoughton@google.com" , "agordeev@linux.ibm.com" , "alex@ghiti.fr" , "aou@eecs.berkeley.edu" , "borntraeger@linux.ibm.com" , "chenhuacai@kernel.org" , "baolu.lu@linux.intel.com" , "dev.jain@arm.com" , "gor@linux.ibm.com" , "hca@linux.ibm.com" , "palmer@dabbelt.com" , "pjw@kernel.org" , "shijie@os.amperecomputing.com" , "svens@linux.ibm.com" , "thuth@redhat.com" , "Liam.Howlett@oracle.com" , "urezki@gmail.com" , "zhengqi.arch@bytedance.com" , "pavel@kernel.org" , "yangyicong@hisilicon.com" , "vannapurve@google.com" , "jackmanb@google.com" , "patrick.roy@linux.dev" , "Thomson, Jack" , "Itazuri, Takahiro" , "Manwaring, Derek" Subject: Re: [PATCH v12 01/16] set_memory: set_direct_map_* to take address X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Brendan Jackman" To: "David Hildenbrand (Arm)" , "Brendan Jackman" , "Lorenzo Stoakes" , "Kalyazin, Nikita" References: <20260410151746.61150-1-kalyazin@amazon.com> <20260410151746.61150-2-kalyazin@amazon.com> In-Reply-To: X-Migadu-Flow: FLOW_OUT On Fri Jun 26, 2026 at 2:58 PM UTC, David Hildenbrand (Arm) wrote: > On 6/26/26 16:38, Brendan Jackman wrote: >> On Tue Apr 21, 2026 at 2:43 PM UTC, Lorenzo Stoakes wrote: >>> On Fri, Apr 10, 2026 at 03:17:58PM +0000, Kalyazin, Nikita wrote: >>>> From: Nikita Kalyazin >>>> >>>> Let's convert set_direct_map_*() to take an address instead of a page = to >>>> prepare for adding helpers that operate on folios; it will be more >>>> efficient to convert from a folio directly to an address without going >>>> through a page first. >>=20 >> Why is this more efficient? Isn't it a purely compile-time conversion? >>=20 >> Indeed in the current implementation folio_address() is >> page_address(&folio->page) so it still goes through a page anyway, no? >>=20 >> I might be missing context here about how this will look in the >> memdesc future. > > Good question. page_address() is really only complicated for highmem. For > non-highmem stuff it's simply derived from the page pfn. > > I suspect going page -> pfn will remain as efficient as it currently is (= with > vmemmap). For odd cases (SPARSEMEM without VMEMMAP) going through folio->= pfn [1] > might be slighty faster. > > [1] https://kernelnewbies.org/MatthewWilcox/Memdescs/Path Ah sorry I raced with you and replied to myself: https://lore.kernel.org/all/DJJ2NKKPRANG.188CUADJO2CKK@linux.dev/ The above makes me realise that if we really do want to avoid needing a struct page here, the "right" thing would be to make this API accept a PFN. The problem would be that our favourite programming language we use doesn't know the difference between `unsigned long addr` and `unsigned long pfn`... but I thiiiiink its unlikely those bugs will be latent, I've made that mistake a few times and my computer usually let me know about it. Still, I'm not really convinced we need to change anything here yet (modulo fuzziness about memdesc etc).