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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C69EC4167B for ; Mon, 4 Dec 2023 12:26:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343983AbjLDM00 (ORCPT ); Mon, 4 Dec 2023 07:26:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229944AbjLDM0Y (ORCPT ); Mon, 4 Dec 2023 07:26:24 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 381F9C3 for ; Mon, 4 Dec 2023 04:26:31 -0800 (PST) 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 492471424; Mon, 4 Dec 2023 04:27:18 -0800 (PST) Received: from [10.57.73.130] (unknown [10.57.73.130]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8B0583F5A1; Mon, 4 Dec 2023 04:26:28 -0800 (PST) Message-ID: <6dd6164a-1dd5-46e7-bcf7-b62ff5c6e8ec@arm.com> Date: Mon, 4 Dec 2023 12:26:27 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 4/4] mm/mmu_gather: Store and process pages in contig ranges Content-Language: en-GB To: Zi Yan , Matthew Wilcox Cc: Will Deacon , "Aneesh Kumar K.V" , Andrew Morton , Nick Piggin , Peter Zijlstra , Christian Borntraeger , Sven Schnelle , Arnd Bergmann , David Hildenbrand , Yu Zhao , "Kirill A. Shutemov" , Yin Fengwei , Yang Shi , "Huang, Ying" , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20230810103332.3062143-1-ryan.roberts@arm.com> <20230810103332.3062143-5-ryan.roberts@arm.com> <800937DA-BAD0-4C60-B155-AECCA21E955E@nvidia.com> <1a0f5cb8-421c-4f28-a986-f3c381406e81@arm.com> <90EC4C0D-0254-4B93-AFD5-3C09580A77DE@nvidia.com> From: Ryan Roberts In-Reply-To: <90EC4C0D-0254-4B93-AFD5-3C09580A77DE@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>> >>> Also, struct page (memmap) might not be always contiguous, using struct page >>> points to represent folio range might not give the result you want. >>> See nth_page() and folio_page_idx() in include/linux/mm.h. >> >> Is that true for pages within the same folio too? Or are all pages in a folio >> guarranteed contiguous? Perhaps I'm better off using pfn? > > folio_page_idx() says not all pages in a folio is guaranteed to be contiguous. > PFN might be a better choice. Hi Zi, Matthew, Zi made this comment a couple of months back that it is incorrect to assume that `struct page`s within a folio are (virtually) contiguous. I'm not sure if that's really the case though? I see other sites in the source that do page++ when iterating over a folio. e.g. smaps_account(), splice_folio_into_pipe(), __collapse_huge_page_copy(), etc. Any chance someone could explain the rules? Thanks, Ryan