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 16AA8C001B0 for ; Wed, 26 Jul 2023 16:45:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231661AbjGZQpT (ORCPT ); Wed, 26 Jul 2023 12:45:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231640AbjGZQpH (ORCPT ); Wed, 26 Jul 2023 12:45:07 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A86912D4B for ; Wed, 26 Jul 2023 09:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ffylz1uSDobu0cDe/+ol0i31EM3nl1BynfNdms0slZc=; b=MeDYCY3TCPK1hNuburzA798uN2 9fiomyfW0Yl8idOiy2Fr6RaeMcXeMKgMKCzfABamLPZSJsaXqe3lflR3Ao8XJo7hv6RCyktjKGyNv F6D7dBbE4LpEZIOwos7xPVBZzDFgdP2S3Aj5AZ5lYCdUv0/WUulUNCoUb/u+Klv/SwKIUsuCXYrWK OJdfTymAd49aKh3IfJEl38VXhyyfuT1vteFdlLaMatdLzQsf4HIiusFz+9iKgQ3We/KAU4Qfz/KFB T0TDOyDsr3A6HmoVUVuZInrJX4ZoAZgaPzqCGiEDW41zFd/KG/+zFviUe2XV//jvJYk7ZdL7N7Lnx eM9Ct09w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qOhd4-006f6o-Tm; Wed, 26 Jul 2023 16:44:50 +0000 Date: Wed, 26 Jul 2023 17:44:50 +0100 From: Matthew Wilcox To: Yu Zhao Cc: Ryan Roberts , Andrew Morton , Yin Fengwei , David Hildenbrand , Yang Shi , "Huang, Ying" , Zi Yan , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 2/3] mm: Implement folio_remove_rmap_range() Message-ID: References: <20230720112955.643283-1-ryan.roberts@arm.com> <20230720112955.643283-3-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 25, 2023 at 11:53:26PM -0600, Yu Zhao wrote: > > +void folio_remove_rmap_range(struct folio *folio, struct page *page, > > + int nr, struct vm_area_struct *vma); > > I prefer folio_remove_rmap_range(page, nr, vma). Passing both the > folio and the starting page seems redundant to me. > > Matthew, is there a convention (function names, parameters, etc.) for > operations on a range of pages within a folio? We've been establishing that convention recently, yes. It seems pointless to re-derive the folio from the page when the caller already has the folio. I also like Ryan's point that it reinforces that all pages must be from the same folio. > And regarding the refactor, what I have in mind is that > folio_remove_rmap_range() is the core API and page_remove_rmap() is > just a wrapper around it, i.e., folio_remove_rmap_range(page, 1, vma). > > Let me post a diff later and see if it makes sense to you. I think that can make sense. Because we limit to a single page table, specifying 'nr = 1 << PMD_ORDER' is the same as 'compound = true'. Just make it folio, page, nr, vma. I'd actually prefer it as (vma, folio, page, nr), but that isn't the convention we've had in rmap up until now.