From patchwork Thu Feb 16 16:05:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yin Fengwei X-Patchwork-Id: 13143462 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 D8967C61DA4 for ; Thu, 16 Feb 2023 16:24:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1C20C6B0074; Thu, 16 Feb 2023 11:24:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1717C6B0075; Thu, 16 Feb 2023 11:24:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F2C3B6B0078; Thu, 16 Feb 2023 11:24:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E15166B0074 for ; Thu, 16 Feb 2023 11:24:02 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8FF83120682 for ; Thu, 16 Feb 2023 16:24:02 +0000 (UTC) X-FDA: 80473676724.08.1F89787 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by imf07.hostedemail.com (Postfix) with ESMTP id 09C2E40003 for ; Thu, 16 Feb 2023 16:23:58 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Vk7ehqvm; spf=pass (imf07.hostedemail.com: domain of fengwei.yin@intel.com designates 134.134.136.20 as permitted sender) smtp.mailfrom=fengwei.yin@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676564639; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=UCVGVzbGOj6nSY0Xre4Jiqva3fI981tXrWQgsEKi3TU=; b=aCveFDlsrZ5uowPoIruCeRFTX1MebnF8DhkRnAlrSxdm9nxgjo3eky/SsDTHbGrtXrqdkG iBubHl8mn7/yM95hE3XL/QOCux0fReem+UeDiVGbJfl2kPXtpl43eT2EmZ5GWotonc1Ud4 4aDjA4qEbzXACcP5uxvZQzJGSAJYGzU= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Vk7ehqvm; spf=pass (imf07.hostedemail.com: domain of fengwei.yin@intel.com designates 134.134.136.20 as permitted sender) smtp.mailfrom=fengwei.yin@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676564639; a=rsa-sha256; cv=none; b=C5TbrmwmlQaIdkQKWgW44VnY7dniWO7JFIVC/91OO8dUpU+Uj9abLbCLtjqwYGGwS4K0ag FDOINgSSmxMAafcZvod69zEBi1ajBCBL3w2Gh6UxMrHF4CU9qtM552GZ7Zy8BJRPOl6NrW uTMsGKtHDoUhD0F2gvygQwklpts6a4k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676564639; x=1708100639; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DHRxEroRnQsnwmr8DiY+XEo82K4MP2f42ZhEh8hKQH4=; b=Vk7ehqvmDPG52E+Ezm/IaD7skRDISIMXevL+m4Yc2qFSKa9AGRCQnw3v tNGhFkwjzxzzN2ugZdcWkG5BaRJbHCV53XRSMEyNU4X+R3cQ9P5QPk6jm kj10gpHp4KacjO/mN6DpD6rDsDm4kYlNupcXl3qwqEukezDbKHuGtBCQI QEtDP+p/R8VX0CG4GFbgCAM/I0aSNtb9pMlTdlPgLlokEqsqRKQCzZuO/ 19k4vjpDPzh75xruxqh/Lk1Gpoo3Kj8MjTibgkHjOa1AMAB6xnDykOo5R IgMxn4xKSG4Gp3zFRu7/qCXRkF5gvVkmnnf3aQGyHbLhi5vtx6GrlqGm4 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10623"; a="319841101" X-IronPort-AV: E=Sophos;i="5.97,302,1669104000"; d="scan'208";a="319841101" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2023 08:04:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10623"; a="794069862" X-IronPort-AV: E=Sophos;i="5.97,302,1669104000"; d="scan'208";a="794069862" Received: from fyin-dev.sh.intel.com ([10.239.159.32]) by orsmga004.jf.intel.com with ESMTP; 16 Feb 2023 08:04:00 -0800 From: Yin Fengwei To: willy@infradead.org, linux-mm@kvack.org Cc: fengwei.yin@intel.com Subject: [RFC PATCH 1/2] mm: remove duplicated flush_dcache_folio() Date: Fri, 17 Feb 2023 00:05:27 +0800 Message-Id: <20230216160528.2146188-2-fengwei.yin@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230216160528.2146188-1-fengwei.yin@intel.com> References: <20230216160528.2146188-1-fengwei.yin@intel.com> MIME-Version: 1.0 X-Stat-Signature: gaoasm3fysguuqxftz5fczze48p4iyh5 X-Rspam-User: X-Rspamd-Queue-Id: 09C2E40003 X-Rspamd-Server: rspam06 X-HE-Tag: 1676564638-618926 X-HE-Meta: U2FsdGVkX196TJm9Qy/J3V5V1PKXW/BOzHTuS98Q//roqM7/t21NbL3UU6HGSVX1hG3Vc+JJEj6dHarZSln9aluyqRG7PTQP6t2t50fbr8oS3lk11a4i5lc2nYYqVi+uRg2+bmhiXMbftklTTV1rxtEVjOpE6PAsc6+zHM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amicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: folio_zero_range() calls the flush_dcache_folio() already. Remove unnecessary flush_dcache_folio() call. Signed-off-by: Yin Fengwei --- fs/libfs.c | 1 - mm/shmem.c | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index 4eda519c3002..d57370c8e382 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -543,7 +543,6 @@ EXPORT_SYMBOL(simple_setattr); static int simple_read_folio(struct file *file, struct folio *folio) { folio_zero_range(folio, 0, folio_size(folio)); - flush_dcache_folio(folio); folio_mark_uptodate(folio); folio_unlock(folio); return 0; diff --git a/mm/shmem.c b/mm/shmem.c index 448f393d8ab2..66e50f0a15ab 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1401,7 +1401,6 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc) goto redirty; } folio_zero_range(folio, 0, folio_size(folio)); - flush_dcache_folio(folio); folio_mark_uptodate(folio); } @@ -2010,11 +2009,7 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index, * it now, lest undo on failure cancel our earlier guarantee. */ if (sgp != SGP_WRITE && !folio_test_uptodate(folio)) { - long i, n = folio_nr_pages(folio); - - for (i = 0; i < n; i++) - clear_highpage(folio_page(folio, i)); - flush_dcache_folio(folio); + folio_zero_range(folio, 0, folio_size(folio)); folio_mark_uptodate(folio); }