From patchwork Tue Mar 22 21:42:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12789112 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 E15C9C433F5 for ; Tue, 22 Mar 2022 21:42:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6EB196B00B2; Tue, 22 Mar 2022 17:42:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A58B6B00B3; Tue, 22 Mar 2022 17:42:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5140D6B00B4; Tue, 22 Mar 2022 17:42:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 39DD76B00B2 for ; Tue, 22 Mar 2022 17:42:17 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 0779681A3E for ; Tue, 22 Mar 2022 21:42:17 +0000 (UTC) X-FDA: 79273345914.01.3409BF4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf14.hostedemail.com (Postfix) with ESMTP id DFD67100025 for ; Tue, 22 Mar 2022 21:42:12 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B4DA66101E; Tue, 22 Mar 2022 21:42:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79B3BC340EC; Tue, 22 Mar 2022 21:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1647985332; bh=ktw58zu8xgeKHCa3X+x2f4+6x3oBLULyuw0PLP0DeCE=; h=Date:To:From:In-Reply-To:Subject:From; b=jpR7VHY/RGLdGpuQJbzxribKOCS9jZvbwYbAe1LtsPLrOIGuCaEjTRy5IkAUcgnzd dJmt2NiUWEPr8FshxzgMM4Fi956HcAhdMfJEeiH+VxAB2/vjH6hzNK8OU/dRp34ApI OdbcUpPBPw6wJRZhC/XiGqYCDmx9h3bSr5MwDROM= Date: Tue, 22 Mar 2022 14:42:11 -0700 To: ziy@nvidia.com,rientjes@google.com,peterx@redhat.com,mike.kravetz@oracle.com,lars.persson@axis.com,kirill.shutemov@linux.intel.com,fam.zheng@bytedance.com,duanxiongchun@bytedance.com,axelrasmussen@google.com,songmuchun@bytedance.com,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220322143803.04a5e59a07e48284f196a2f9@linux-foundation.org> Subject: [patch 072/227] mm: replace multiple dcache flush with flush_dcache_folio() Message-Id: <20220322214212.79B3BC340EC@smtp.kernel.org> X-Stat-Signature: z1eoxqkb5c5m53681r8fzfcodgycdtsh Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="jpR7VHY/"; spf=pass (imf14.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: DFD67100025 X-HE-Tag: 1647985332-597714 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: From: Muchun Song Subject: mm: replace multiple dcache flush with flush_dcache_folio() Simplify the code by using flush_dcache_folio(). Link: https://lkml.kernel.org/r/20220210123058.79206-8-songmuchun@bytedance.com Signed-off-by: Muchun Song Reviewed-by: Mike Kravetz Cc: Axel Rasmussen Cc: David Rientjes Cc: Fam Zheng Cc: Kirill A. Shutemov Cc: Lars Persson Cc: Peter Xu Cc: Xiongchun Duan Cc: Zi Yan Signed-off-by: Andrew Morton --- mm/migrate.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- a/mm/migrate.c~mm-replace-multiple-dcache-flush-with-flush_dcache_folio +++ a/mm/migrate.c @@ -916,12 +916,8 @@ static int move_to_new_page(struct page if (!PageMappingFlags(page)) page->mapping = NULL; - if (likely(!is_zone_device_page(newpage))) { - int i, nr = compound_nr(newpage); - - for (i = 0; i < nr; i++) - flush_dcache_page(newpage + i); - } + if (likely(!is_zone_device_page(newpage))) + flush_dcache_folio(page_folio(newpage)); } out: return rc;