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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 020B1C41513 for ; Thu, 27 Jul 2023 01:31:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 23C338D0001; Wed, 26 Jul 2023 21:31:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1ECB16B0074; Wed, 26 Jul 2023 21:31:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B4FE8D0001; Wed, 26 Jul 2023 21:31:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id ED6EC6B0072 for ; Wed, 26 Jul 2023 21:31:09 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id AD27FC0F4D for ; Thu, 27 Jul 2023 01:31:09 +0000 (UTC) X-FDA: 81055663458.25.2A8C4ED Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by imf24.hostedemail.com (Postfix) with ESMTP id A0C9018000B for ; Thu, 27 Jul 2023 01:31:06 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=DV9z3dPn; spf=pass (imf24.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.31 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690421467; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=G7ChADySwEy8jqdqkO8F996jkDJ4598L9ncVWa/0ttY=; b=RjF+KzIN27pwMncg38fuAoFHW8jp9ZCIsf4MR2xDcQbh3lAChqNFUEAzB89bneFZmDzylV olM8e50WLB4ASCAecIkJlT/oY3BocHRoIsHtVjmJKVc2ji5Rzte0H8IudhCCF4qYrhI+sI icy4E0De11cgaBgZF9hMlnKW2bwoj9k= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=DV9z3dPn; spf=pass (imf24.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.31 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690421467; a=rsa-sha256; cv=none; b=IRwm6/NIBIAe9O9t6s1VnJ79O6VnhsJN2KA3dqgXKJcYKwcDjJbBvWMhoyMD3L75YpwBK6 0A9szx2ALS0ex885pBviWn7Lx7rSQM3xIBvCubSUcSr9YznQsD631Tr0aZ9n7d6h47xOdE n8HLpdVzpNzfGGwKspHAMMZdpEhO0Ng= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690421466; x=1721957466; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=NDV92DL8w7Vy/CvizZ8BwdNttadDo9vdLl+Mid7imWc=; b=DV9z3dPnTyXOz/EbjP8eO5yMxzXh8Hrkrt5ov1NziEFqtzj5rGnvS0qK Al4OHmJjrewZ5PCU7+bN/VwZyoCuqm267uAJ8goNu20MkDuHW8cf4nakn 18HqXN+wIzXeLVcANohmJb/0lvc4gfipm/xE5WKK4r17AhBoHuOjtqxS4 0PajoO1rhBYmHc4jTacwCS4fQMxI8PaOkXnr8HETyqZOUoHppE06OVpN0 L4xBfeGWqf8NSB+kapwHxfYCfiD7osDCz+EgUfUAp88r2GeYGziuum0pt 64TDu6NTVHm0K9aKkvZnzfc635r+pv92/8N5hoGzt0VCuu5z8IHhjNqpw w==; X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="431974744" X-IronPort-AV: E=Sophos;i="6.01,233,1684825200"; d="scan'208";a="431974744" 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-Rspamd-Queue-Id: A0C9018000B X-Rspam-User: X-Stat-Signature: y66izohmrr6q6r9bebyxtcsqr1wdsds6 X-Rspamd-Server: rspam01 X-HE-Tag: 1690421466-438764 X-HE-Meta: U2FsdGVkX1+9OpsA7MVMIyp+lnQgliwMJpIMx7btpWNdoyjYpiDztfn3A8nAG1e6bc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ZNE++bC/8303Ua3v7QQA2S1a+L9wvcdJnnEZAbgwXVHVzq8x7N2sLQnL54xhaJwt+rFGq2PABq590oIn532jkSBwhISr+U X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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