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 E5D88C001DE for ; Wed, 19 Jul 2023 18:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230403AbjGSSq6 (ORCPT ); Wed, 19 Jul 2023 14:46:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230291AbjGSSqy (ORCPT ); Wed, 19 Jul 2023 14:46:54 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 12D321FDC for ; Wed, 19 Jul 2023 11:46:50 -0700 (PDT) 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 177632F4; Wed, 19 Jul 2023 11:47:33 -0700 (PDT) Received: from [10.57.76.81] (unknown [10.57.76.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EF49D3F67D; Wed, 19 Jul 2023 11:46:47 -0700 (PDT) Message-ID: <10cdc414-c2d6-90c0-2810-9cdda0323423@arm.com> Date: Wed, 19 Jul 2023 19:46:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2 2/3] mm: Implement folio_remove_rmap_range() To: Yu Zhao Cc: Andrew Morton , Matthew Wilcox , Yin Fengwei , David Hildenbrand , Yang Shi , "Huang, Ying" , Zi Yan , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20230719135450.545227-1-ryan.roberts@arm.com> <20230719135450.545227-3-ryan.roberts@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/07/2023 19:23, Yu Zhao wrote: > On Wed, Jul 19, 2023 at 7:55 AM Ryan Roberts wrote: >> >> Like page_remove_rmap() but batch-removes the rmap for a range of pages >> belonging to a folio. This can provide a small speedup due to less >> manipuation of the various counters. But more crucially, if removing the >> rmap for all pages of a folio in a batch, there is no need to >> (spuriously) add it to the deferred split list, which saves significant >> cost when there is contention for the split queue lock. >> >> All contained pages are accounted using the order-0 folio (or base page) >> scheme. >> >> Reviewed-by: Yin Fengwei >> Reviewed-by: Zi Yan >> Signed-off-by: Ryan Roberts > > I have asked for this before but let me be very clear this time: we > need to generalize the existing functions rather than add more > specialized functions. Otherwise it'd get even harder to maintain down > the road. Yeah fair enough, my fault; I wrote this before I had your feedback on the other rmap function and overlooked it when refactoring this. I'll fix it and repost. > > folio_remove_rmap_range() needs to replace page_remove_rmap(). IOW, > page_remove_rmap() is just a wrapper around folio_remove_rmap_range().