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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34382C636C8 for ; Thu, 15 Jul 2021 22:20:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 13FFF61360 for ; Thu, 15 Jul 2021 22:20:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232114AbhGOWXm (ORCPT ); Thu, 15 Jul 2021 18:23:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231547AbhGOWXl (ORCPT ); Thu, 15 Jul 2021 18:23:41 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6C2BC06175F; Thu, 15 Jul 2021 15:20:47 -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=XyOzjVd5xv9UTPCfq0G+15JQNVxKW8TyYTiG0nAPA8w=; b=FMQVRor86Nwv/OQ7Smz3KjErMl artn8SEfy3MRpb7yjC91QDQHpjYi5BXFE6mZr5wW/mWmDfxfdPY9iGTi0bi9jWEw/fX5ltVJLAZTB 1GUWL/CiVhhYoOz20bQt7iDwZmjmT6xkF7tOVsqFvZGIoid77ypDOP8M3PUykMUzb2BVGqligwQK7 RMUW+xOYgM3CFpXIzwwTHmG/ZddpdZRI7JwKTqqBCxogbZ1E610ljj3wHyvvUSj4H0wfrg3MCPBLk QYodRw4Oa8WnlbxqHFRhAsdlRXTXk2N3uwCAtkJt3q07Vtoe/sREFEPjfn6T57YY/raIh52a5Eg17 CfDup3sQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m49iL-003vpR-Tj; Thu, 15 Jul 2021 22:20:26 +0000 Date: Thu, 15 Jul 2021 23:20:17 +0100 From: Matthew Wilcox To: "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v14 124/138] fs: Convert vfs_dedupe_file_range_compare to folios Message-ID: References: <20210715033704.692967-1-willy@infradead.org> <20210715033704.692967-125-willy@infradead.org> <20210715220840.GS22357@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210715220840.GS22357@magnolia> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 15, 2021 at 03:08:40PM -0700, Darrick J. Wong wrote: > On Thu, Jul 15, 2021 at 04:36:50AM +0100, Matthew Wilcox (Oracle) wrote: > > We still only operate on a single page of data at a time due to using > > kmap(). A more complex implementation would work on each page in a folio, > > but it's not clear that such a complex implementation would be worthwhile. > > Does this break up a compound folio into smaller pages? No. We just operate on each page in turn. Splitting a folio is an expensive and unrealiable thing to do, so we avoid it unless necessary. > > +/* Unlock two folios, being careful not to unlock the same folio twice. */ > > +static void vfs_unlock_two_folios(struct folio *folio1, struct folio *folio2) > > { > > - unlock_page(page1); > > - if (page1 != page2) > > - unlock_page(page2); > > + folio_unlock(folio1); > > + if (folio1 != folio2) > > + folio_unlock(folio2); > > This could result in a lot of folio lock cycling. Do you think it's > worth the effort to minimize this by keeping the folio locked if the > next page is going to be from the same one? I think that might well be a worthwhile optimisation. I'd like to do that as a separate patch, though (and maybe somebody other than me could do it ;-)