From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6CD58C43458 for ; Fri, 26 Jun 2026 15:09:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:To:From:Subject: Cc:Message-Id:Date:Mime-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LgVwlzKT3ywvfAvw21ZbtDnGfWXuvHgM9sV6aPGyoGg=; b=CAMKZIF8Ai3s56 1UK41wCFfnhKLM1tYMBSUEjJYUne4Oon9x7UkOXd5P/u9uCKtU29F5RABLDHZ2ljDJL8Qw1On8uOq Lq8yHEYqyg0IVHh6Eqm98QU+enxhkDfFgUSJ02W2GbBCFrEA2Vt+Z11agSeFbrpTUBjaF5s34Ec7v gbGBJbROmGhSx7ZYRVPfNmcz+byIskfo6EindDpMu4E+zZvNraFV6p4qtca88ksRl7pocJ29HMagM HSxVlGqti0gGLSxfOKVHRahMzpwcxzrMHzB5dUZcDw8OPKvlkJoNwfcf8U1a6++kaTJ81ySKZDGWl x/LTLK4XvlN8TOg7qxJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wd8Au-0000000BWnj-1NqD; Fri, 26 Jun 2026 15:09:00 +0000 Received: from out-179.mta0.migadu.com ([91.218.175.179]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wd8Aq-0000000BWn8-14Pd; Fri, 26 Jun 2026 15:08:57 +0000 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= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260626_080856_441185_50CDFA09 X-CRM114-Status: GOOD ( 12.59 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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. >> >> Why is this more efficient? Isn't it a purely compile-time conversion? >> >> Indeed in the current implementation folio_address() is >> page_address(&folio->page) so it still goes through a page anyway, no? >> >> 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). _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv