From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brian Foster Date: Tue, 7 Jun 2022 09:41:57 -0400 Subject: [Cluster-devel] [PATCH 05/20] mm/migrate: Convert expected_page_refs() to folio_expected_refs() In-Reply-To: <20220606204050.2625949-6-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> <20220606204050.2625949-6-willy@infradead.org> Message-ID: List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Mon, Jun 06, 2022 at 09:40:35PM +0100, Matthew Wilcox (Oracle) wrote: > Now that both callers have a folio, convert this function to > take a folio & rename it. > > Signed-off-by: Matthew Wilcox (Oracle) > --- > mm/migrate.c | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 77b8c662c9ca..e0a593e5b5f9 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -337,13 +337,18 @@ void pmd_migration_entry_wait(struct mm_struct *mm, pmd_t *pmd) > } > #endif > > -static int expected_page_refs(struct address_space *mapping, struct page *page) > +static int folio_expected_refs(struct address_space *mapping, > + struct folio *folio) > { > - int expected_count = 1; > + int refs = 1; > + if (!mapping) > + return refs; > > - if (mapping) > - expected_count += compound_nr(page) + page_has_private(page); > - return expected_count; > + refs += folio_nr_pages(folio); > + if (folio_get_private(folio)) > + refs++; Why not folio_has_private() (as seems to be used for later page_has_private() conversions) here? > + > + return refs;; Nit: extra ; Brian > } > > /* > @@ -360,7 +365,7 @@ int folio_migrate_mapping(struct address_space *mapping, > XA_STATE(xas, &mapping->i_pages, folio_index(folio)); > struct zone *oldzone, *newzone; > int dirty; > - int expected_count = expected_page_refs(mapping, &folio->page) + extra_count; > + int expected_count = folio_expected_refs(mapping, folio) + extra_count; > long nr = folio_nr_pages(folio); > > if (!mapping) { > @@ -670,7 +675,7 @@ static int __buffer_migrate_folio(struct address_space *mapping, > return migrate_page(mapping, &dst->page, &src->page, mode); > > /* Check whether page does not have extra refs before we do more work */ > - expected_count = expected_page_refs(mapping, &src->page); > + expected_count = folio_expected_refs(mapping, src); > if (folio_ref_count(src) != expected_count) > return -EAGAIN; > > -- > 2.35.1 > > 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 E76D5C433EF for ; Tue, 7 Jun 2022 13:42:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244851AbiFGNmF (ORCPT ); Tue, 7 Jun 2022 09:42:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239533AbiFGNmF (ORCPT ); Tue, 7 Jun 2022 09:42:05 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 13CAF5EDD2 for ; Tue, 7 Jun 2022 06:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654609322; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=U9GWchY9hZYcIJP7lDw5j1KYfu5h/jhdfCsZWPH40Q8=; b=GUkPRVvGUaOPnIf6DZL/xbvEbUulIJsi4e84BNLzLRFPmLgR9yyBwuILWOy/L68zsvLQ4W NA/y71u6QOWL/EA35pe1+dB0OyyL1DEoGWD4VkqL9VB2bVAcCe+4zzh+yvw3fhM7WfOxTp wTPxybpsRn/Ze/T5xon5LLk1IlB9AGY= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-591-1TyP0WMcPou2fg7Nbedojg-1; Tue, 07 Jun 2022 09:42:01 -0400 X-MC-Unique: 1TyP0WMcPou2fg7Nbedojg-1 Received: by mail-qv1-f71.google.com with SMTP id kj4-20020a056214528400b0044399a9bb4cso10890834qvb.15 for ; Tue, 07 Jun 2022 06:42:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=U9GWchY9hZYcIJP7lDw5j1KYfu5h/jhdfCsZWPH40Q8=; b=4t9tm8djZW01vAUKMq11CjKEr5efHRIXVn2ybaknbiIrRPItJDadOcYAvJu+re3Sd0 ayH2tFgwZISgjg+2/slp0SFxpplZjI0TrQT48E/+JvpfPWuxUSlqjRZo/RbxgiyvCXZb bC1+E6q5ZdjP46PVoLE07glaNpdPWBYHA9TKC5Y91M76DRijxJtKSi+7qd87FMYDCAV4 9Dd/NOQkPa1GR0s0jWsJE/s43R8PUnkVyk3i8Og+/nxFtc3Y5lNvfk1F+/o3aKd+h6Bh sTrNlPJRDC/LhM9EqfKVSIWo28SF+YzhXOuNm9ClbqHbeQaRHVQuPAn559PGh9x7fuPy kRxg== X-Gm-Message-State: AOAM531LDndelF1ru4k64C2aryjrFezaUYEHNxB12nJF/BKgoD1kZBjD GE7qtIGouWpHjAidO4WuKOYfoqan1V82j5I+fdXWCNWSG985CQ3ezd7CpVZEfYc9qMjQADopWhh xhshgFabwaRwirjnjXQb1uqw= X-Received: by 2002:ac8:5acc:0:b0:304:f75a:4a1d with SMTP id d12-20020ac85acc000000b00304f75a4a1dmr3015557qtd.120.1654609320536; Tue, 07 Jun 2022 06:42:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyavNr4YW+NLtrlTYw3DwYvyx9zxVnBrVGsEoQi3F5ODngxQYCXvCvG44n4ArB8DEsaTyYSw== X-Received: by 2002:ac8:5acc:0:b0:304:f75a:4a1d with SMTP id d12-20020ac85acc000000b00304f75a4a1dmr3015540qtd.120.1654609320271; Tue, 07 Jun 2022 06:42:00 -0700 (PDT) Received: from bfoster (c-24-61-119-116.hsd1.ma.comcast.net. [24.61.119.116]) by smtp.gmail.com with ESMTPSA id ay33-20020a05620a17a100b006a6f68c8a87sm148860qkb.126.2022.06.07.06.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 06:41:59 -0700 (PDT) Date: Tue, 7 Jun 2022 09:41:57 -0400 From: Brian Foster To: "Matthew Wilcox (Oracle)" Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-aio@kvack.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-mm@kvack.org, linux-xfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-ntfs-dev@lists.sourceforge.net, ocfs2-devel@oss.oracle.com, linux-mtd@lists.infradead.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH 05/20] mm/migrate: Convert expected_page_refs() to folio_expected_refs() Message-ID: References: <20220606204050.2625949-1-willy@infradead.org> <20220606204050.2625949-6-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220606204050.2625949-6-willy@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Mon, Jun 06, 2022 at 09:40:35PM +0100, Matthew Wilcox (Oracle) wrote: > Now that both callers have a folio, convert this function to > take a folio & rename it. > > Signed-off-by: Matthew Wilcox (Oracle) > --- > mm/migrate.c | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 77b8c662c9ca..e0a593e5b5f9 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -337,13 +337,18 @@ void pmd_migration_entry_wait(struct mm_struct *mm, pmd_t *pmd) > } > #endif > > -static int expected_page_refs(struct address_space *mapping, struct page *page) > +static int folio_expected_refs(struct address_space *mapping, > + struct folio *folio) > { > - int expected_count = 1; > + int refs = 1; > + if (!mapping) > + return refs; > > - if (mapping) > - expected_count += compound_nr(page) + page_has_private(page); > - return expected_count; > + refs += folio_nr_pages(folio); > + if (folio_get_private(folio)) > + refs++; Why not folio_has_private() (as seems to be used for later page_has_private() conversions) here? > + > + return refs;; Nit: extra ; Brian > } > > /* > @@ -360,7 +365,7 @@ int folio_migrate_mapping(struct address_space *mapping, > XA_STATE(xas, &mapping->i_pages, folio_index(folio)); > struct zone *oldzone, *newzone; > int dirty; > - int expected_count = expected_page_refs(mapping, &folio->page) + extra_count; > + int expected_count = folio_expected_refs(mapping, folio) + extra_count; > long nr = folio_nr_pages(folio); > > if (!mapping) { > @@ -670,7 +675,7 @@ static int __buffer_migrate_folio(struct address_space *mapping, > return migrate_page(mapping, &dst->page, &src->page, mode); > > /* Check whether page does not have extra refs before we do more work */ > - expected_count = expected_page_refs(mapping, &src->page); > + expected_count = folio_expected_refs(mapping, src); > if (folio_ref_count(src) != expected_count) > return -EAGAIN; > > -- > 2.35.1 > > 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 804ADC433EF for ; Tue, 7 Jun 2022 13:42:18 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.94.2) (envelope-from ) id 1nyZTM-0003yp-0j; Tue, 07 Jun 2022 13:42:14 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nyZTJ-0003yj-VP for linux-f2fs-devel@lists.sourceforge.net; Tue, 07 Jun 2022 13:42:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=U9GWchY9hZYcIJP7lDw5j1KYfu5h/jhdfCsZWPH40Q8=; b=PBDnxqao+2gCJIexxOP+fgA+hK c3iTnYKUZyWgFxclYfNq+bcTE+fE5ujwJChbfPym3nIrX4CQZgIc46Siu+2PWcsaqgAqINHi8CTMe 2QDSEJtPcZnXYgBxeg2pzt87KK6k2bwAYXOfuWby/LL+OFFwAkhHLyGVuDexRkZgRxgc=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=U9GWchY9hZYcIJP7lDw5j1KYfu5h/jhdfCsZWPH40Q8=; b=WbThZ/CdojaAwhOON4qrt9C1SB gQkyUT46u2yuDAthj/EhQnsUKC4EIuKpusjzUu0ikRWDU+A88qZuEmrELWifWPS65B+S4px0Uy2Nj sp2FvjO8D4sYPa1Ag8Z40AKTMJnCpeeDZlGNToTIrq8Vz0ca/PLlE05GFRMEBKfezmQA=; Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.94.2) id 1nyZTE-008HLZ-5H for linux-f2fs-devel@lists.sourceforge.net; Tue, 07 Jun 2022 13:42:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654609322; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=U9GWchY9hZYcIJP7lDw5j1KYfu5h/jhdfCsZWPH40Q8=; b=GUkPRVvGUaOPnIf6DZL/xbvEbUulIJsi4e84BNLzLRFPmLgR9yyBwuILWOy/L68zsvLQ4W NA/y71u6QOWL/EA35pe1+dB0OyyL1DEoGWD4VkqL9VB2bVAcCe+4zzh+yvw3fhM7WfOxTp wTPxybpsRn/Ze/T5xon5LLk1IlB9AGY= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-591-6X4fui0LOdagZbpkPEbYEg-1; Tue, 07 Jun 2022 09:42:01 -0400 X-MC-Unique: 6X4fui0LOdagZbpkPEbYEg-1 Received: by mail-qv1-f72.google.com with SMTP id kk8-20020a056214508800b004645738eff6so7743765qvb.8 for ; Tue, 07 Jun 2022 06:42:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=U9GWchY9hZYcIJP7lDw5j1KYfu5h/jhdfCsZWPH40Q8=; b=smlfxzGOUzxSDhai/t7JaMf8k1TcrBTYUrnCzfjQGStb25Ac78TwGLzluNv0vUXGY+ 7nE7M+Bq+OgkFE2b1Jc+byYpyJqK7jO3KMMaYerzJQsQrBrV9kVmdjbPld4ZGzgxmz7m GOvz//+B8a37sZHgjINw8Jg3fi5sywgXCFgCwB5fIsZuBR+50n8GCWuRzOCSBWcePj+a ipGNy4wQljhbddnW/L3aedOMSLWqbtBYABqEv52r8udE8QPN0Ds/TCmI22EzMNW8uiko doyGzIk+H+cfY2rhXAv41eIskg14hds0Wl6Yf9Nh0IB1PQcD62+OaABLyp3bv4J1RYtp F2Rg== X-Gm-Message-State: AOAM533VEmGAE55wMvJzncXXUWxFWuS5FBxS97aw1WbzpLTdPNZqyXe4 qN1AE2sdMvY2i+Gefdb8+krkl7QAmmon62jw1sJMlpvRK0WGDO7m0QxtvfIX1qrMkBBGBmy2GtC OQVyrfzrPdNT/Sakev+NauzFTERZtwvK9lzo6Lg== X-Received: by 2002:ac8:5acc:0:b0:304:f75a:4a1d with SMTP id d12-20020ac85acc000000b00304f75a4a1dmr3015560qtd.120.1654609320539; Tue, 07 Jun 2022 06:42:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyavNr4YW+NLtrlTYw3DwYvyx9zxVnBrVGsEoQi3F5ODngxQYCXvCvG44n4ArB8DEsaTyYSw== X-Received: by 2002:ac8:5acc:0:b0:304:f75a:4a1d with SMTP id d12-20020ac85acc000000b00304f75a4a1dmr3015540qtd.120.1654609320271; Tue, 07 Jun 2022 06:42:00 -0700 (PDT) Received: from bfoster (c-24-61-119-116.hsd1.ma.comcast.net. [24.61.119.116]) by smtp.gmail.com with ESMTPSA id ay33-20020a05620a17a100b006a6f68c8a87sm148860qkb.126.2022.06.07.06.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 06:41:59 -0700 (PDT) Date: Tue, 7 Jun 2022 09:41:57 -0400 From: Brian Foster To: "Matthew Wilcox (Oracle)" Message-ID: References: <20220606204050.2625949-1-willy@infradead.org> <20220606204050.2625949-6-willy@infradead.org> MIME-Version: 1.0 In-Reply-To: <20220606204050.2625949-6-willy@infradead.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=bfoster@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Headers-End: 1nyZTE-008HLZ-5H Subject: Re: [f2fs-dev] [PATCH 05/20] mm/migrate: Convert expected_page_refs() to folio_expected_refs() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On Mon, Jun 06, 2022 at 09:40:35PM +0100, Matthew Wilcox (Oracle) wrote: > Now that both callers have a folio, convert this function to > take a folio & rename it. > > Signed-off-by: Matthew Wilcox (Oracle) > --- > mm/migrate.c | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 77b8c662c9ca..e0a593e5b5f9 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -337,13 +337,18 @@ void pmd_migration_entry_wait(struct mm_struct *mm, pmd_t *pmd) > } > #endif > > -static int expected_page_refs(struct address_space *mapping, struct page *page) > +static int folio_expected_refs(struct address_space *mapping, > + struct folio *folio) > { > - int expected_count = 1; > + int refs = 1; > + if (!mapping) > + return refs; > > - if (mapping) > - expected_count += compound_nr(page) + page_has_private(page); > - return expected_count; > + refs += folio_nr_pages(folio); > + if (folio_get_private(folio)) > + refs++; Why not folio_has_private() (as seems to be used for later page_has_private() conversions) here? > + > + return refs;; Nit: extra ; Brian > } > > /* > @@ -360,7 +365,7 @@ int folio_migrate_mapping(struct address_space *mapping, > XA_STATE(xas, &mapping->i_pages, folio_index(folio)); > struct zone *oldzone, *newzone; > int dirty; > - int expected_count = expected_page_refs(mapping, &folio->page) + extra_count; > + int expected_count = folio_expected_refs(mapping, folio) + extra_count; > long nr = folio_nr_pages(folio); > > if (!mapping) { > @@ -670,7 +675,7 @@ static int __buffer_migrate_folio(struct address_space *mapping, > return migrate_page(mapping, &dst->page, &src->page, mode); > > /* Check whether page does not have extra refs before we do more work */ > - expected_count = expected_page_refs(mapping, &src->page); > + expected_count = folio_expected_refs(mapping, src); > if (folio_ref_count(src) != expected_count) > return -EAGAIN; > > -- > 2.35.1 > > _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A372C43334 for ; Tue, 7 Jun 2022 13:44:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bvy+oJDwmmfd9fmY3EpeFBroYryNUmb8EzXQuf+1vCY=; b=eyKzBtJYWSPw8W ZPjZSph4/Bl0g75TE3+KNCg9dwWddyZykZyNOfG+3BBXhSd32QOmACtsyGrOnfjqkZbBWG8doKJm9 PQWEX6/T/ZofnLj2djtzxGB/wusPHCXkVbWKAQ2oycUf9nHQjcMoj5JKZVnTs9lPPLkdA43mGYtrU MqDTGT5dmfwldmcUbH5F0bFiGuzsKM3DvHBKmqbuW5h/cIvWoQNiQHEBsBKhusXNCS/tqTsTddS9U CysbY34uO8thIsE6hfvs0ScCvsKk0C0C/xLbQX8kL5qaCsnAP0i1b4El2877wh+0Xj7FCFed1W68A 9fyee90GIG12uFqdZl/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyZV8-007pNC-Ay; Tue, 07 Jun 2022 13:44:06 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyZV6-007pL4-6J for linux-mtd@lists.infradead.org; Tue, 07 Jun 2022 13:44:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654609442; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=U9GWchY9hZYcIJP7lDw5j1KYfu5h/jhdfCsZWPH40Q8=; b=CWkFV4GhCNj7hOC5jqVznUw+XA0PwoGX1Ntz74NJFWeY3lwvYfCXZS5nvkSTQHtOoFAwG4 nusMZVWHOaYCBWUq8O836WEAWw+fwb7XoSVwLF9qKVfGFiGrV+WqhKHughITs9Pp2I+0Uv e6/7ObrCNpbh0k267F2+G2FPueU0dHo= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-622-SDgkI2LUMyODo1Y6qJcPGw-1; Tue, 07 Jun 2022 09:42:01 -0400 X-MC-Unique: SDgkI2LUMyODo1Y6qJcPGw-1 Received: by mail-qt1-f199.google.com with SMTP id s7-20020ac85cc7000000b00304e11cb41fso9007358qta.4 for ; Tue, 07 Jun 2022 06:42:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=U9GWchY9hZYcIJP7lDw5j1KYfu5h/jhdfCsZWPH40Q8=; b=xq75tsKA4KZstUsn9IT/BY09/QzOv9GIHHcWbg0awjbHMcW4bCJe7xa2TLFU0nkq08 6ZJ0h/ZsmUvsJuWK9hsYXviROgMlI8wRNXPoFL7d96fRETNqGBi7JLwWW0sl3lIvC+pi WIWTqW0PE0DhVvaWl86WRRf2PcI/MH6Dhky3Jh01rEcJxWHjv5z0LTGjAAQFsWz4r7Cr I3/HRolz+wdyMNyDMX4yFQDbjOd3eq4z8TLmZBGDJ0U+P/Kb51exMURMuOWaP2gda+QR Yn8r1ESXbbujxXb+b6dc0E8U+uiUyYmDdT+iJM82FaXx/WzyuOoup3P17VC0Q2Yu9IKX 2OMg== X-Gm-Message-State: AOAM5318+eFttCg8bxQu+tiCJXmcRT8AktXgl7jgS6PCWC8Ktw4l6xBC 7NJhDKyYGJzyi2lgmccnMNpM9frYEzSqi/KkyFuu+4iOtZ0hqL1Kip2TY0VJaswOVVXaBkYodDp AjugMZBpwELNCau7xwqnsfz5ePg== X-Received: by 2002:ac8:5acc:0:b0:304:f75a:4a1d with SMTP id d12-20020ac85acc000000b00304f75a4a1dmr3015575qtd.120.1654609320592; Tue, 07 Jun 2022 06:42:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyavNr4YW+NLtrlTYw3DwYvyx9zxVnBrVGsEoQi3F5ODngxQYCXvCvG44n4ArB8DEsaTyYSw== X-Received: by 2002:ac8:5acc:0:b0:304:f75a:4a1d with SMTP id d12-20020ac85acc000000b00304f75a4a1dmr3015540qtd.120.1654609320271; Tue, 07 Jun 2022 06:42:00 -0700 (PDT) Received: from bfoster (c-24-61-119-116.hsd1.ma.comcast.net. [24.61.119.116]) by smtp.gmail.com with ESMTPSA id ay33-20020a05620a17a100b006a6f68c8a87sm148860qkb.126.2022.06.07.06.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 06:41:59 -0700 (PDT) Date: Tue, 7 Jun 2022 09:41:57 -0400 From: Brian Foster To: "Matthew Wilcox (Oracle)" Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-aio@kvack.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-mm@kvack.org, linux-xfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-ntfs-dev@lists.sourceforge.net, ocfs2-devel@oss.oracle.com, linux-mtd@lists.infradead.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH 05/20] mm/migrate: Convert expected_page_refs() to folio_expected_refs() Message-ID: References: <20220606204050.2625949-1-willy@infradead.org> <20220606204050.2625949-6-willy@infradead.org> MIME-Version: 1.0 In-Reply-To: <20220606204050.2625949-6-willy@infradead.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=bfoster@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220607_064404_319318_976AFDF9 X-CRM114-Status: GOOD ( 20.51 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Mon, Jun 06, 2022 at 09:40:35PM +0100, Matthew Wilcox (Oracle) wrote: > Now that both callers have a folio, convert this function to > take a folio & rename it. > > Signed-off-by: Matthew Wilcox (Oracle) > --- > mm/migrate.c | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 77b8c662c9ca..e0a593e5b5f9 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -337,13 +337,18 @@ void pmd_migration_entry_wait(struct mm_struct *mm, pmd_t *pmd) > } > #endif > > -static int expected_page_refs(struct address_space *mapping, struct page *page) > +static int folio_expected_refs(struct address_space *mapping, > + struct folio *folio) > { > - int expected_count = 1; > + int refs = 1; > + if (!mapping) > + return refs; > > - if (mapping) > - expected_count += compound_nr(page) + page_has_private(page); > - return expected_count; > + refs += folio_nr_pages(folio); > + if (folio_get_private(folio)) > + refs++; Why not folio_has_private() (as seems to be used for later page_has_private() conversions) here? > + > + return refs;; Nit: extra ; Brian > } > > /* > @@ -360,7 +365,7 @@ int folio_migrate_mapping(struct address_space *mapping, > XA_STATE(xas, &mapping->i_pages, folio_index(folio)); > struct zone *oldzone, *newzone; > int dirty; > - int expected_count = expected_page_refs(mapping, &folio->page) + extra_count; > + int expected_count = folio_expected_refs(mapping, folio) + extra_count; > long nr = folio_nr_pages(folio); > > if (!mapping) { > @@ -670,7 +675,7 @@ static int __buffer_migrate_folio(struct address_space *mapping, > return migrate_page(mapping, &dst->page, &src->page, mode); > > /* Check whether page does not have extra refs before we do more work */ > - expected_count = expected_page_refs(mapping, &src->page); > + expected_count = folio_expected_refs(mapping, src); > if (folio_ref_count(src) != expected_count) > return -EAGAIN; > > -- > 2.35.1 > > ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ 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 aib29ajc254.phx1.oracleemaildelivery.com (aib29ajc254.phx1.oracleemaildelivery.com [192.29.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C75FFC43334 for ; Tue, 7 Jun 2022 13:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=h3EPq2wrZVhp3KfmXtHRbn14SLsdny7sQRECxGxTTZs=; b=XWliGWj2UHSQeAKOvxHdqFQAweGug8184H1VekmG+stZ2SjC39auApc24xilMb4v9PBKpBSFvjP8 WPg/XoWqyTMxsTr3abNyqy0f9fVg0utiEbZiklzoTUZTwnGmqDTXx25fK0mrgoNn4tpToGVyYWtE xPawgaDu1GsNc/TryZkMGQ1S7gocbzXqAbEn6+ZXFzW4I3OPHYtED29itw4eqQfvDQrTJPNRb/ed 4z/3A7b2F/qdKry2H4U+tMVdI9JBpjV56M4vcJPvc0JJF71J4iIu0k1Apa4kv4vsp4wElk+SYyef IxnxjCrIulz4Jlri8hsz57kqFId0GUzAWJ1aVQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=h3EPq2wrZVhp3KfmXtHRbn14SLsdny7sQRECxGxTTZs=; b=f6dTTd8LOwVU+maDE/iSf95l/uwSe80HSYElF3cWSBh4/IAYXSqAI7PcbBUnq1FCLtfykW5WO26l EVmtHIH5z7aSH6MXh7lsXPKaxgYZ0ZP/R1d6sJb82hkw8tzKUcoyKWxfjjxMK+hZT6NFV+T5zmP5 1Gduk7/s1dwj09/cpnqPgYlC7JpG9eatkHIXYBVwiQkTOlAognxZxksNpee70xL31mia331bjrq6 BhG5TiH13NVK8xxW+JAj9aDWT/mc+wtYKjA45oxzIZD33Cx1r+qJMCXQ/uv1pviXUhma3qBaXugi U323jxtdkc1w6UY6GItitIx5ypFdplMLlvpcUA== Received: by omta-ad3-fd3-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD400G4L0QO7X60@omta-ad3-fd3-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Tue, 07 Jun 2022 13:42:24 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654609324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=U9GWchY9hZYcIJP7lDw5j1KYfu5h/jhdfCsZWPH40Q8=; b=RRi4QjAn7sx1oxiTav2LXVEYk4HjhJ6sIs/BBH9vY97myKLAzT5nH3hG6OkQEzW0icahmL X9YGMngXem6pGZs0mF3Gu3WsNGsOhCbyluyFNnOwEOlwv3RSHJuynzgqmc2z7z0luUvi7t 2If3Mg/3tHHa9z/ezVwoOCuCAtbsmSM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=U9GWchY9hZYcIJP7lDw5j1KYfu5h/jhdfCsZWPH40Q8=; b=Q0TOQRx47ObjlFWEil9+kquWLqMD7gNfyjMuIY3uAbrklmdOgNXXC2vszfDJ1O2r5s SCu+RhCbCpKdMgANaqE6rZ+cQ2wdYktP5hT2Ept95Ycw+5Jbn5nTZIg8oa4Y3bCSKnkj oTMZA59RfVM1ARFqFOUIt/3d3KJEbgIRAgw5W9O+qpZNxaSOjx2L98+FLeUCVD8GhzYW iyTKJS3Arolg7EHz529FHwLzoSEBAigchAaCCa7yXdXxspwZcWBrW2b6wYmw41o3pfNf 6GSQydeqZ+coy75riXczdotr/ZliikhDJpqoc/OPxv5b/VyK+uWQ5GyUCw+Z+ZML+YDr FYAA== X-Gm-Message-State: AOAM5319KTeM8+4UJlTGVII8MOon9gBTmOrzlews2+ZcU1blBzYGgwFb iv9M9fh9HP1QTfrAefQDPYW+zjPc7CaxxiDFEMwkqc1DmlhF/AuNdK+AlJUN2ANyzT79ipiGWeq 25OQh24WUN9OjiVinccl+DQ== X-Received: by 2002:ac8:5acc:0:b0:304:f75a:4a1d with SMTP id d12-20020ac85acc000000b00304f75a4a1dmr3015556qtd.120.1654609320536; Tue, 07 Jun 2022 06:42:00 -0700 (PDT) X-Received: by 2002:ac8:5acc:0:b0:304:f75a:4a1d with SMTP id d12-20020ac85acc000000b00304f75a4a1dmr3015540qtd.120.1654609320271; Tue, 07 Jun 2022 06:42:00 -0700 (PDT) Date: Tue, 7 Jun 2022 09:41:57 -0400 To: "Matthew Wilcox (Oracle)" Message-id: References: <20220606204050.2625949-1-willy@infradead.org> <20220606204050.2625949-6-willy@infradead.org> MIME-version: 1.0 In-reply-to: <20220606204050.2625949-6-willy@infradead.org> Authentication-results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=bfoster@redhat.com Content-disposition: inline X-Source-IP: 170.10.129.124 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10371 signatures=594849 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: Re: [Ocfs2-devel] [PATCH 05/20] mm/migrate: Convert expected_page_refs() to folio_expected_refs() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Brian Foster via Ocfs2-devel Reply-to: Brian Foster Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-MC-Unique: JmuO7pQKNUWXLXWY47Z-zg-1 X-Google-Smtp-Source: ABdhPJyyavNr4YW+NLtrlTYw3DwYvyx9zxVnBrVGsEoQi3F5ODngxQYCXvCvG44n4ArB8DEsaTyYSw== X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 ip4:103.23.64.2 ip4:103.23.65.2 ip4:103.23.66.26 ip4:103.23.67.26 ip4:107.21.15.141 ip4:108.177.8.0/21 ip4:128.17.0.0/20 ip4:128.17.128.0/20 ip4:128.17.192.0/20 ip4:128.17.64.0/20 ip4:128.245.0.0/20 ip4:128.245.64.0/20 ip4:13.110.208.0/21 ip4:13.110.216.0/22 ip4:13.110.224.0/20 ip4:13.111.0.0/16 ip4:136.147.128.0/20 include:spf1.redhat.com -all X-Proofpoint-SPF-VenPass: Allowed X-ServerName: us-smtp-delivery-124.mimecast.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 ip4:103.23.64.2 ip4:103.23.65.2 ip4:103.23.66.26 ip4:103.23.67.26 ip4:107.21.15.141 ip4:108.177.8.0/21 ip4:128.17.0.0/20 ip4:128.17.128.0/20 ip4:128.17.192.0/20 ip4:128.17.64.0/20 ip4:128.245.0.0/20 ip4:128.245.64.0/20 ip4:13.110.208.0/21 ip4:13.110.216.0/22 ip4:13.110.224.0/20 ip4:13.111.0.0/16 ip4:136.147.128.0/20 include:spf1.redhat.com -all X-Proofpoint-Spam-Reason: safe X-Spam: OrgSafeList X-SpamRule: orgsafelist X-Proofpoint-GUID: 1RP1TKqwAFGRdgIeDQwA0Sysj6mICmbf X-Proofpoint-ORIG-GUID: 1RP1TKqwAFGRdgIeDQwA0Sysj6mICmbf Reporting-Meta: AAFkcIS6h1XGbefDGn7CgjNGhuXeZ4ta+5hGLxszNOODxxLlrdrponGTNgl1xir2 MYRYxft/u/z9n4kHRgss55vNTyUy/6O4WiEpns8yeMIaXwKSJu3eqvky44ZITbML Tu8Wf6vRbVlJsiLlmddHGvL6BtnMaOXvFe5OyHHYUrcl61aMd+lEFYoXt6pNXVwv 1W2mpSnK3JZ6kkHIOd0NWYNwzYYTxG+s0X7hf2EDk/KtIiU8DKXX55oSEGQg+ofo ODsb6WgGIqw2eGGXx9b5qD4gxDFeO10Q8lcJaxeQowKjpku+i/DeuUCi7FjHXFTz wmdn/XiOdsKIrlUNX9Gp5L9kCKSguojNB7kE1NHJKBxk9ipZdrS5Bl/RjpjDOtKZ MHRhDJLVEWujkoGJgZ5P77p39GjofdgUlkqSpRblIJHBHPSR8F1tgIKbY8RI44Po OvO1k7Mmrt0xwIQoeiQmwRRFLqbfMs4hwD7aLZBDW3ah7zBxhXFAh+JeIHmdxwgp +riKjzNwj8Vw8zkD62aR5+QtPzOW6s+RISQzPlP+N23j On Mon, Jun 06, 2022 at 09:40:35PM +0100, Matthew Wilcox (Oracle) wrote: > Now that both callers have a folio, convert this function to > take a folio & rename it. > > Signed-off-by: Matthew Wilcox (Oracle) > --- > mm/migrate.c | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 77b8c662c9ca..e0a593e5b5f9 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -337,13 +337,18 @@ void pmd_migration_entry_wait(struct mm_struct *mm, pmd_t *pmd) > } > #endif > > -static int expected_page_refs(struct address_space *mapping, struct page *page) > +static int folio_expected_refs(struct address_space *mapping, > + struct folio *folio) > { > - int expected_count = 1; > + int refs = 1; > + if (!mapping) > + return refs; > > - if (mapping) > - expected_count += compound_nr(page) + page_has_private(page); > - return expected_count; > + refs += folio_nr_pages(folio); > + if (folio_get_private(folio)) > + refs++; Why not folio_has_private() (as seems to be used for later page_has_private() conversions) here? > + > + return refs;; Nit: extra ; Brian > } > > /* > @@ -360,7 +365,7 @@ int folio_migrate_mapping(struct address_space *mapping, > XA_STATE(xas, &mapping->i_pages, folio_index(folio)); > struct zone *oldzone, *newzone; > int dirty; > - int expected_count = expected_page_refs(mapping, &folio->page) + extra_count; > + int expected_count = folio_expected_refs(mapping, folio) + extra_count; > long nr = folio_nr_pages(folio); > > if (!mapping) { > @@ -670,7 +675,7 @@ static int __buffer_migrate_folio(struct address_space *mapping, > return migrate_page(mapping, &dst->page, &src->page, mode); > > /* Check whether page does not have extra refs before we do more work */ > - expected_count = expected_page_refs(mapping, &src->page); > + expected_count = folio_expected_refs(mapping, src); > if (folio_ref_count(src) != expected_count) > return -EAGAIN; > > -- > 2.35.1 > > _______________________________________________ Ocfs2-devel mailing list Ocfs2-devel@oss.oracle.com https://oss.oracle.com/mailman/listinfo/ocfs2-devel 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 smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02552C433EF for ; Tue, 7 Jun 2022 13:42:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 7E1AA42491; Tue, 7 Jun 2022 13:42:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pUJb5BXqlqWe; Tue, 7 Jun 2022 13:42:08 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id AC49341873; Tue, 7 Jun 2022 13:42:07 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7CBECC0039; Tue, 7 Jun 2022 13:42:07 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6F262C002D for ; Tue, 7 Jun 2022 13:42:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 49AB960F30 for ; Tue, 7 Jun 2022 13:42:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TfP3D8JhLcb5 for ; Tue, 7 Jun 2022 13:42:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 6FEF16100D for ; Tue, 7 Jun 2022 13:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654609324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=U9GWchY9hZYcIJP7lDw5j1KYfu5h/jhdfCsZWPH40Q8=; b=RRi4QjAn7sx1oxiTav2LXVEYk4HjhJ6sIs/BBH9vY97myKLAzT5nH3hG6OkQEzW0icahmL X9YGMngXem6pGZs0mF3Gu3WsNGsOhCbyluyFNnOwEOlwv3RSHJuynzgqmc2z7z0luUvi7t 2If3Mg/3tHHa9z/ezVwoOCuCAtbsmSM= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-323-1l_svAg-Nha8BL7jMxTEuA-1; Tue, 07 Jun 2022 09:42:01 -0400 X-MC-Unique: 1l_svAg-Nha8BL7jMxTEuA-1 Received: by mail-qt1-f198.google.com with SMTP id t14-20020a05622a01ce00b002ff91ea4445so13999021qtw.2 for ; Tue, 07 Jun 2022 06:42:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=U9GWchY9hZYcIJP7lDw5j1KYfu5h/jhdfCsZWPH40Q8=; b=YlzZIyruXXY9b3NCJOq0NAS0n2d1ObrnTQyg3oKB7J2y/I1NN1b6Z+tFZvFenQB0ew i+QerdEHhl0pNO2e2pkqrDVhZoUmjvPOT26WTSIOtdVZE3s5dzoWF4uhCyMRjwYZ1EjG 5m7fwEMGC0kEtapXveUh7px5WeAaTXHcuVBXvkjTRx5IuvB7kzbw14B9F1FwyNeIexxj S9YUDA/NqQ/DBhE67cLScTvxUbPfyoNldXpaww9cFH+L5wpGA1j+kNDcdlx1JNdPw2yt SI4hE9bDq3cvjUIAyY1u1WGMvWk/FsWu48EWCyVjlAlz/FL8IrqwTnfGPexr+tfXmYYj wT9w== X-Gm-Message-State: AOAM532ABkkCivQ7B6mR0IMGUHVH+hi0+V5UgjJ8vvyxrsdQLxYwC5jx +Ev4FHp1pv8BzZZAPxgPiebk5RspHvr01AHZk8qzadFphOZxWn+ajfuj2GcyKBsQu2JOMDFZN9e a8rwkeoZPni/NJmv2Irtqt+BIJ3zxsq777jh293ImYg== X-Received: by 2002:ac8:5acc:0:b0:304:f75a:4a1d with SMTP id d12-20020ac85acc000000b00304f75a4a1dmr3015568qtd.120.1654609320541; Tue, 07 Jun 2022 06:42:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyavNr4YW+NLtrlTYw3DwYvyx9zxVnBrVGsEoQi3F5ODngxQYCXvCvG44n4ArB8DEsaTyYSw== X-Received: by 2002:ac8:5acc:0:b0:304:f75a:4a1d with SMTP id d12-20020ac85acc000000b00304f75a4a1dmr3015540qtd.120.1654609320271; Tue, 07 Jun 2022 06:42:00 -0700 (PDT) Received: from bfoster (c-24-61-119-116.hsd1.ma.comcast.net. [24.61.119.116]) by smtp.gmail.com with ESMTPSA id ay33-20020a05620a17a100b006a6f68c8a87sm148860qkb.126.2022.06.07.06.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 06:41:59 -0700 (PDT) Date: Tue, 7 Jun 2022 09:41:57 -0400 From: Brian Foster To: "Matthew Wilcox (Oracle)" Subject: Re: [PATCH 05/20] mm/migrate: Convert expected_page_refs() to folio_expected_refs() Message-ID: References: <20220606204050.2625949-1-willy@infradead.org> <20220606204050.2625949-6-willy@infradead.org> MIME-Version: 1.0 In-Reply-To: <20220606204050.2625949-6-willy@infradead.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=bfoster@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Mon, Jun 06, 2022 at 09:40:35PM +0100, Matthew Wilcox (Oracle) wrote: > Now that both callers have a folio, convert this function to > take a folio & rename it. > > Signed-off-by: Matthew Wilcox (Oracle) > --- > mm/migrate.c | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 77b8c662c9ca..e0a593e5b5f9 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -337,13 +337,18 @@ void pmd_migration_entry_wait(struct mm_struct *mm, pmd_t *pmd) > } > #endif > > -static int expected_page_refs(struct address_space *mapping, struct page *page) > +static int folio_expected_refs(struct address_space *mapping, > + struct folio *folio) > { > - int expected_count = 1; > + int refs = 1; > + if (!mapping) > + return refs; > > - if (mapping) > - expected_count += compound_nr(page) + page_has_private(page); > - return expected_count; > + refs += folio_nr_pages(folio); > + if (folio_get_private(folio)) > + refs++; Why not folio_has_private() (as seems to be used for later page_has_private() conversions) here? > + > + return refs;; Nit: extra ; Brian > } > > /* > @@ -360,7 +365,7 @@ int folio_migrate_mapping(struct address_space *mapping, > XA_STATE(xas, &mapping->i_pages, folio_index(folio)); > struct zone *oldzone, *newzone; > int dirty; > - int expected_count = expected_page_refs(mapping, &folio->page) + extra_count; > + int expected_count = folio_expected_refs(mapping, folio) + extra_count; > long nr = folio_nr_pages(folio); > > if (!mapping) { > @@ -670,7 +675,7 @@ static int __buffer_migrate_folio(struct address_space *mapping, > return migrate_page(mapping, &dst->page, &src->page, mode); > > /* Check whether page does not have extra refs before we do more work */ > - expected_count = expected_page_refs(mapping, &src->page); > + expected_count = folio_expected_refs(mapping, src); > if (folio_ref_count(src) != expected_count) > return -EAGAIN; > > -- > 2.35.1 > > _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization