Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1758630rwb; Wed, 26 Jul 2023 18:49:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlHfk1MBXVNEwl7K+RtEeULYT+l4v2Kduw0u7vMLSEL5lX39IEicg/8mCM9B7A59DvZz7MW+ X-Received: by 2002:ac2:58d4:0:b0:4fe:95e:159a with SMTP id u20-20020ac258d4000000b004fe095e159amr505610lfo.23.1690422546367; Wed, 26 Jul 2023 18:49:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690422546; cv=none; d=google.com; s=arc-20160816; b=HUSZemGE+lgIRox7o9KKJLuwK4Rb5x7v8DMI2H2m/wXBR5FXRxZiYMZrPO+iNqoY5e N77YF3WjEBSG0hcHFYy0N5vXEp1W2YtqkQWrSonu5zWl4D51ep7GcaS19fNcpDf2Yfbo aSVML1+2ZYtLNkp4q/yl/bSO9ohDx7yfBZIqqmjmtY1glP/90JR5yYmPpl0F1XiFvV0e hd4X5RSigISHjzWm8p5PTsc8RzZ76L7x4UgEjv97+cDSrbPmETs8z7Gh89Q1valzwVIH dQUEvokjHo6U9oeTnL1Hg9ljSXoDIE0em6cYffLD2HkZ8tzW8BSrrsqwl7dLqSfBnp8q suCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=G7ChADySwEy8jqdqkO8F996jkDJ4598L9ncVWa/0ttY=; fh=W3/OyzjSkq3MmLxUA6feYKw9sdPX8z0SRZPO019r2vc=; b=TII6ANONegdOOoDbZwwyyNuz8XUmO8ilqoTLKLeAA8ivSraBCgjRDEi5nH+nTq2vcw pkNTwgCqrcv0ao97pHIIffiUCGbC3bo9BM0+nwTZm+DSZ+1AiPMxux65UD+Ks4tPl3+D mnUEOZarT1fUNFg0AlOZi9oMXv5sQNqkltHVnh8wM1HhUeP4VxTRLrPrAlK0q9mSn0Kj 7khxqcJb5vdHO1+EtFyvze/a7WLIdTmXs5m/mFu6dol6XMAC9hqS0x62InU1sYolBD6q HCBO7eB9LyNhpRZBKFBXnCXiOHDB3muXFujezxxSLhL+bnWj21l4o1lvPNJjOZRrhoyp U+UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mPi24KRd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o23-20020aa7c517000000b0051e1c495a0csi146825edq.376.2023.07.26.18.48.41; Wed, 26 Jul 2023 18:49:06 -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=@intel.com header.s=Intel header.b=mPi24KRd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230491AbjG0BbH (ORCPT + 99 others); Wed, 26 Jul 2023 21:31:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbjG0BbG (ORCPT ); Wed, 26 Jul 2023 21:31:06 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44B151985 for ; Wed, 26 Jul 2023 18:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690421465; x=1721957465; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=NDV92DL8w7Vy/CvizZ8BwdNttadDo9vdLl+Mid7imWc=; b=mPi24KRdH3ymxrRLjXf03+Lu85dHDYwqQpNPx/1kK0Z69GJOSKc3z+cp ELq/JaEGYR736vbnwvYLp3Lb49Tbwj1pc0CnG7LuMiqWHILkp28QEiVld BWiaLx+Ce7STAEiUgZyk1UbqQwh8p1eJdsHnbr2Nes0mXORmZX5aKalgE 3M8xPxlLPDM+L5LEW7WfFC3wWmfbhhp0+gj75gSJncLg6qa9FGc+NJevD Wb4aUzXiIw/9Kqf0PyNVrwPldJHIJXMTyoLcTrIfpSfF4h/uaG5/bPPbU mnhYs/I5ehVbf2ud02qAEEwMfA1+OW291b67Ash9VYj8oo9+URog4oVfq g==; X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="431974745" X-IronPort-AV: E=Sophos;i="6.01,233,1684825200"; d="scan'208";a="431974745" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2023 18:31:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="792114036" X-IronPort-AV: E=Sophos;i="6.01,233,1684825200"; d="scan'208";a="792114036" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2023 18:31:01 -0700 From: "Huang, Ying" To: Matthew Wilcox Cc: Yu Zhao , Ryan Roberts , Andrew Morton , Yin Fengwei , David Hildenbrand , Yang Shi , Zi Yan , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 2/3] mm: Implement folio_remove_rmap_range() References: <20230720112955.643283-1-ryan.roberts@arm.com> <20230720112955.643283-3-ryan.roberts@arm.com> Date: Thu, 27 Jul 2023 09:29:24 +0800 In-Reply-To: (Matthew Wilcox's message of "Wed, 26 Jul 2023 17:44:50 +0100") Message-ID: <87r0ouw39n.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Matthew Wilcox writes: > 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. IIUC, even if 'nr = 1 << PMD_ORDER', we may remove one PMD 'compound' mapping, or 'nr' PTE mapping. So, we will still need 'compound' (or some better name) as parameter. -- Best Regards, Huang, Ying