From patchwork Tue Feb 8 07:36:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12738260 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 0DB27C433F5 for ; Tue, 8 Feb 2022 07:37:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A24506B007E; Tue, 8 Feb 2022 02:37:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D5456B0080; Tue, 8 Feb 2022 02:37:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C3B26B0081; Tue, 8 Feb 2022 02:37:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0003.hostedemail.com [216.40.44.3]) by kanga.kvack.org (Postfix) with ESMTP id 7FC176B007E for ; Tue, 8 Feb 2022 02:37:00 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 4CFC192EC6 for ; Tue, 8 Feb 2022 07:37:00 +0000 (UTC) X-FDA: 79118806200.06.992F6FE Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf21.hostedemail.com (Postfix) with ESMTP id EEC3C1C000B for ; Tue, 8 Feb 2022 07:36:59 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id c3so13160489pls.5 for ; Mon, 07 Feb 2022 23:36:59 -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=ppq4XlgFUv42e60ZLq/R/m9c3uPkEPmuzaFcdHPRBnk=; b=xVoHJj/4zyPvyg7fneG+v1w0Ib0159bkGEZFF8GmxqGz1GIqJQvjHPPWQUUBQVBWSi yR2SPqfsbh97O8Bk0wkaV2DY7IDHGcuTgyVWO/W/8a0okGQfamKHXNVAIF4if1wm6/w5 iiwk1B4JgZBA4eWoYz+PU1VYZ55CZdIYVNH4J5zSrekqulSmRsmD2G0K+Pf8fVKb53hx t4ihL4kylEoaMDcmJaTJcAiXjkdVmkC43SCUedvI61iLAerc6p8houdOghfe1doOVpQa oubwmMrsU31yjFg4iMICpMtw3IcU5yLSUYRvgyulqzAWcjvp0pMZyUz3r23mxXP1tv2z smFQ== 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=ppq4XlgFUv42e60ZLq/R/m9c3uPkEPmuzaFcdHPRBnk=; b=vJT4t7OFMTeW19MnWSURtm5IVMLU4LQ3j/D3nTsCyznc4CLbsFuA0UfNLxowrFf5Pp s/coQBoQZ+fN6aVB634eaLHmPAppzvrPip9n2ZuvSoO0nD8rtQxficg+CyXPCF+Zpy6W EnVT89mWuXGqZUmm1aX81YJe7RiBlRtONzlcHzqIH0DoqczSD3qFfY3akkLsdJnb3Ktp ZG/kHFB+T4BwnO/fHvOq2j7GvP8Y/lZ1xhek6ziuSbMnn3EiHfse+ynpLwWrsWN4n5x+ QYGEo/6ZWAt1IFcLM159BVd+tgiMSJzWfh5UlpgEJ20Q6u3FCr/0WInyRP7u6+7qaOnA YnuQ== X-Gm-Message-State: AOAM5327Oq/9/dDJAs48q/Q9CncAdERw312wc0YujC7A3N40/Iu8aStW QiayUfuFE4aEG+vKJ++Gyka+NA== X-Google-Smtp-Source: ABdhPJzNE1tP0FCmJnNbT+MwdBxWiom5QGlNn45IpoyK3Oqddhm8dX950DKcNeuV59Q8o0qQlea8fA== X-Received: by 2002:a17:902:ab06:: with SMTP id ik6mr3065211plb.162.1644305818957; Mon, 07 Feb 2022 23:36:58 -0800 (PST) Received: from FVFYT0MHHV2J.tiktokcdn.com ([139.177.225.225]) by smtp.gmail.com with ESMTPSA id gx10sm1621017pjb.7.2022.02.07.23.36.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Feb 2022 23:36:58 -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 v4 5/5] mm: replace multiple dcache flush with flush_dcache_folio() Date: Tue, 8 Feb 2022 15:36:17 +0800 Message-Id: <20220208073617.70342-6-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220208073617.70342-1-songmuchun@bytedance.com> References: <20220208073617.70342-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Stat-Signature: zc6rdawwpi5pgow7zejs5a98ty3k49fs X-Rspam-User: Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="xVoHJj/4"; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf21.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.214.172 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: EEC3C1C000B X-HE-Tag: 1644305819-392737 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: 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;