Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1273757rwb; Wed, 26 Jul 2023 09:58:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlGr7AB3jaHxsQl6tU6CjxM761JX9h5z7CYNIqygeSOBF67QKBLzkeupi7ekgWP6d4D9Hl1H X-Received: by 2002:a05:6a00:14c4:b0:668:74e9:8efb with SMTP id w4-20020a056a0014c400b0066874e98efbmr2753246pfu.8.1690390717335; Wed, 26 Jul 2023 09:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690390717; cv=none; d=google.com; s=arc-20160816; b=r3GqxArDkX4GG49gsovDDgnWrKUF49MQ06YGYaYC65eEqBxaJedPlixxxOFnIowbe6 lauBRayb5vLxsLaJoiPszmSN7uEh6yc/Q36vCC+HqFBbWzBQisl9C54drElezcR9zk6F /HkDLGzgqtLiJXx6v8oIAD8WFmYf9B/aTMHMv20iDRR9GssYTNEkDhq8auOid9UpEv+p IpjboyPIEcnayYJEm1JkcQ0MD/8014K2zrxRwx2pC9aZUVGNNg/+8AkKFngActn4+9Xe CDvn5O/fuPxSN9/XO4wQh8yU+GrtKS0tMkQem22m2yloV+IQIzWASreKTAMSBmBnhpgt cY/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ffylz1uSDobu0cDe/+ol0i31EM3nl1BynfNdms0slZc=; fh=FfDRTsk0q1kJIiRtv/7DzJpPNz6/qPPFggDmOF/gR44=; b=U61ZGRElcxCBKhV6/UkfkxYJrhO3PxOEO/g1UprIjE4ciFJxzF5wTiKR3khYvgk+qB h8T+Lvvvol2w/HKgsvtjaJtYVAJBV9nuvXSX1/8Dk6lAbqyy1lsQNrJHY8HVtmlPlKRQ FVix6VOySzIV3h9HfZU9w/v5mvNdVyIIki2FoVgFOevm7cLYSBFwjuCk13RuxYyNep+f qCThcnRMBBsB0BcyctCRSxZq70Ebt8IqB8YjDVLgZJdXQbn4C6M0wi9S9nHjqCMaP9gw JVXAdKKkGyaNdbxDhgILvUIOidjE+N4367SaiacY7N8dfL+FF83xFdzdBItTyjF8oXPk XIpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=MeDYCY3T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o15-20020a637e4f000000b00553caa0c899si13283055pgn.771.2023.07.26.09.58.24; Wed, 26 Jul 2023 09:58:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=MeDYCY3T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231357AbjGZQpT (ORCPT + 99 others); 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: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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.