From patchwork Thu Feb 10 12:30:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12741878 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 26950C4332F for ; Thu, 10 Feb 2022 12:37:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A2FE26B0080; Thu, 10 Feb 2022 07:37:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9B81D6B0081; Thu, 10 Feb 2022 07:37:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 880946B0082; Thu, 10 Feb 2022 07:37:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0102.hostedemail.com [216.40.44.102]) by kanga.kvack.org (Postfix) with ESMTP id 7B5B76B0080 for ; Thu, 10 Feb 2022 07:37:54 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 3660581049EC for ; Thu, 10 Feb 2022 12:37:54 +0000 (UTC) X-FDA: 79126822068.19.31447BD Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by imf02.hostedemail.com (Postfix) with ESMTP id CDBAE80003 for ; Thu, 10 Feb 2022 12:37:53 +0000 (UTC) Received: by mail-pj1-f52.google.com with SMTP id h7-20020a17090a648700b001b927560c2bso4223449pjj.1 for ; Thu, 10 Feb 2022 04:37:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oDahdnw06IsGwB/7M26luCqPUnRrkijqY+ZjOYkno4A=; b=tpGNdIY2hwVGwRhbVAEv6E5VyLyH6hl7LUw7SLZyLIw8PMoLNcP/DUGn0A+TA43MA3 DAp3ueB1y4QZ01hqgxcV1mb3FD1UWVfLo9aGY6MkmnYv1rOx2LYVOFu5ECBqxxAlZ6h7 +fYloX/Dkjb81uKdqULv2aHbXuLal3uHsATiys2WgJE7mplGe4YGnpxk3Z0z9gm5fdvJ Fvl59LuYztWU/omTw0zQNUWaMxPJB3cNt2Hzp19Bnjfm+NtW+p+D6/+bjn6Ikjry2ySE 7IJqRMvlWxRjZy4PkrIHOFY8qSvSNocEuSXW3CRF3ibl5YTyGYBL49XvaPC+KX6yN7Yk TAAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oDahdnw06IsGwB/7M26luCqPUnRrkijqY+ZjOYkno4A=; b=TaiOLCpcKF9o4I3YruCEnWNnAMXmnMHpgckIqjzy3Zd3s2GAyY8xYZyNrqftDhE3Aw yh4jzfTMPft/tPmV5bhCUQTxYcD+tug3sA6qUssab4jegSJaLvPc9vBFnR+akN0t0i3C 9RJD3iCg80FhwhsgajHjymlEL/b3v4kDtNxBcmOz1qY4iA0zne4vdMvcnkZ/jP/5EUBS m2gX5X0zl29agw4k2wqf75c5mDp9/tKaoFuHx7r8E9S1SWQwHpR0k7ia4+8ggaOCsZ2R aQhMUkNHbi9DPUuT5TcY74ZomeWyFJtsOdBK8lMlPdJRF8czBSLThSsNIJrdqlCYTB11 +JJA== X-Gm-Message-State: AOAM532+aOsiotCTGbMIFBxT0wYORdI40mZRlb9fqsCS5eYi74zYBHYM 6vhh9ADaI4hSu0Fu4KJNzCGr9Q== X-Google-Smtp-Source: ABdhPJzn0l92vEIhPNZDK6wnPCBAAD+wPaRAZsukzdXyxqRwg+i/PIhMukVTcN6WwYR8rEu1ZtzJfQ== X-Received: by 2002:a17:90a:fe15:: with SMTP id ck21mr2602609pjb.95.1644496673004; Thu, 10 Feb 2022 04:37:53 -0800 (PST) Received: from FVFYT0MHHV2J.tiktokcdn.com ([139.177.225.237]) by smtp.gmail.com with ESMTPSA id i8sm11767812pgf.94.2022.02.10.04.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 04:37:52 -0800 (PST) From: Muchun Song To: akpm@linux-foundation.org, zi.yan@cs.rutgers.edu, kirill.shutemov@linux.intel.com, rientjes@google.com, lars.persson@axis.com, mike.kravetz@oracle.com, ziy@nvidia.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, duanxiongchun@bytedance.com, fam.zheng@bytedance.com, Muchun Song Subject: [PATCH v5 7/7] mm: replace multiple dcache flush with flush_dcache_folio() Date: Thu, 10 Feb 2022 20:30:58 +0800 Message-Id: <20220210123058.79206-8-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220210123058.79206-1-songmuchun@bytedance.com> References: <20220210123058.79206-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Stat-Signature: 51uiigym3fpb3s7fqdoj74htdes5mqek X-Rspam-User: Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=tpGNdIY2; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf02.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.52 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: CDBAE80003 X-HE-Tag: 1644496673-768834 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000499, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Simplify the code by using flush_dcache_folio(). Signed-off-by: Muchun Song Reviewed-by: Mike Kravetz --- mm/migrate.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index c418e8d92b9c..daf2b3508670 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -933,12 +933,8 @@ static int move_to_new_page(struct page *newpage, struct page *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;