Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp288137pxm; Wed, 2 Mar 2022 15:30:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkOLAPOgasBddhnwA775bkxsRSG0ZP+mi6LoRjtwMvGsMwptIiUq1N0/BC6Lli8SytIOx5 X-Received: by 2002:a17:903:11c6:b0:151:a247:31eb with SMTP id q6-20020a17090311c600b00151a24731ebmr2941242plh.91.1646263853747; Wed, 02 Mar 2022 15:30:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646263853; cv=none; d=google.com; s=arc-20160816; b=gnYggh2O2qltkrtj+G707mpuXyzX1pkAExZi7nfXtgYw6HNkZnszZ5DH82EB50SVkO v33akV9nbdVoYJOZARb2EeDTre3tma9cvHsSwnkYH+2+rBJbSawB6QB8uA8aXj+uAtqb FidYKC7bv2zlmBhYBLytuqQwdUkEQQQ40JUdZ32oe0qesWM2KeRV6tgrwJXL/g30OKGe nAwnU1TWoI3qA4LpiaMtPwkTgwpFJLtHmP04wE4R6NQE24vatyZZ1YSa1IDW9KgSLyq0 Beaf90UDFC8q/YAVyA+KeOjG75Nq9pTM07v/ca6vzQTOawLOhB7Fpg3Bqy0NDiSPqJTa +iig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eiCDiO7SeVqlcAe7b/JTkNhJRMnMslj9oR2/HG6e9n8=; b=n4Obuf30TLokyYGE3m8n6dOAEBdIKjOo5/ab5kJaa3IgFegC6GunKRaxPYUtbQEJCn irOv94JVDv3N5p8g/zqpTFN/9aSEFETNFC2wiK515XPU5HhsxEkcD6niFiggdq6Sw5Uv EBR0QUU8GCecF9qEMSDjAkjibTMGP0YwbsYKYAIKu6lSkKJdNLIe1rmXavDTZH3jhj5a +JKcIJ583i4JTpictZMKn/QiVLXQnoeuAq8Ck2gWIU+r7toKxEMQHbNO1tBrLvTYgEG8 Hoxj4CLOtsnx3JU66xcwThUoqWFw3LvfpmrS/lZl/rYakgGEL54NzavD5q90iwSaHjDQ VWsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=cYJLK58s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id r195-20020a632bcc000000b003749b31aca3si400639pgr.341.2022.03.02.15.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 15:30:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=cYJLK58s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AF34614EF46; Wed, 2 Mar 2022 15:02:21 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240141AbiCBIaK (ORCPT + 99 others); Wed, 2 Mar 2022 03:30:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240131AbiCBIaE (ORCPT ); Wed, 2 Mar 2022 03:30:04 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77D9EB82D9 for ; Wed, 2 Mar 2022 00:29:21 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id 9so951194pll.6 for ; Wed, 02 Mar 2022 00:29:21 -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=eiCDiO7SeVqlcAe7b/JTkNhJRMnMslj9oR2/HG6e9n8=; b=cYJLK58sIMtE77DATtQlxH9dtPyPDOawr2Hs9P06tVu2j6KUemAg7S9UEgucud0DdX 4h/Uh/mP0MROdl00Wa/vvnYHaH6Ya6dm/OxjneqryKBM8Gp6v7zc8BhA27iNEPG1yHH2 Eojft7GBt8tz5GmBW/hk0eB/lgf+Hbk5vSPzs7SU8EZS8jxOTz8PGvLJ6crgihfH37PS nXcScKKh2ZkdzeEMqPdHtVBCvj2or8wIA4avGEhSTLrskKUn6QAREUoUwwRZk01wFFti xXOkL2PqQ9YVw97HrnKwed0fGb91eHchAYlq83PZW206GlgUEgKY4mhHqxy1QcA26b4q Powg== 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=eiCDiO7SeVqlcAe7b/JTkNhJRMnMslj9oR2/HG6e9n8=; b=gwptEOa2u50f7/s9DA30MffvtiR/hirpPj1RmrZDX/iT+lamfHP3l1cDQ193hp6+h/ NZP2ldDhtMTTkcmnxJ4mO0+EWpxgu41Ja+JK5DAf4i0W4kXGUwnnpueE1lgJRyg794cI PwM29NERC3YyL34JrMYP8qzSXQpRAuoBt1oq/PJ7CR64CAHG5XB0g9HIvxQenLE91D6G KZMudamRhcsQuQUAR7wTiaw63gPvVwKNo2+CRdBRXH4xdo+U9VpYxoIik3EU/py75F+m K0mzF5p1PSMR9dgbVNANf8PItpZAW9NB9+Z02N8cDWzZDBRf0mxbdK7VgTA8DEJGbQdT SFxw== X-Gm-Message-State: AOAM5323o+JKrFKjWv8wWRqt6Z02BfWOEggtXREHGXbslmBo7d6yh2d4 3cYRq2bKHTHlnhjyn3HLsCy6aQ== X-Received: by 2002:a17:90a:550b:b0:1bd:1e3a:a407 with SMTP id b11-20020a17090a550b00b001bd1e3aa407mr19607925pji.112.1646209760828; Wed, 02 Mar 2022 00:29:20 -0800 (PST) Received: from FVFYT0MHHV2J.bytedance.net ([61.120.150.70]) by smtp.gmail.com with ESMTPSA id a20-20020a056a000c9400b004f396b965a9sm20922228pfv.49.2022.03.02.00.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 00:29:20 -0800 (PST) From: Muchun Song To: dan.j.williams@intel.com, willy@infradead.org, jack@suse.cz, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, apopple@nvidia.com, shy828301@gmail.com, rcampbell@nvidia.com, hughd@google.com, xiyuyang19@fudan.edu.cn, kirill.shutemov@linux.intel.com, zwisler@kernel.org, hch@infradead.org Cc: linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, smuchun@gmail.com, Muchun Song Subject: [PATCH v4 2/6] dax: fix cache flush on PMD-mapped pages Date: Wed, 2 Mar 2022 16:27:14 +0800 Message-Id: <20220302082718.32268-3-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220302082718.32268-1-songmuchun@bytedance.com> References: <20220302082718.32268-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The flush_cache_page() only remove a PAGE_SIZE sized range from the cache. However, it does not cover the full pages in a THP except a head page. Replace it with flush_cache_range() to fix this issue. Fixes: f729c8c9b24f ("dax: wrprotect pmd_t in dax_mapping_entry_mkclean") Signed-off-by: Muchun Song --- fs/dax.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/dax.c b/fs/dax.c index 67a08a32fccb..a372304c9695 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -845,7 +845,8 @@ static void dax_entry_mkclean(struct address_space *mapping, pgoff_t index, if (!pmd_dirty(*pmdp) && !pmd_write(*pmdp)) goto unlock_pmd; - flush_cache_page(vma, address, pfn); + flush_cache_range(vma, address, + address + HPAGE_PMD_SIZE); pmd = pmdp_invalidate(vma, address, pmdp); pmd = pmd_wrprotect(pmd); pmd = pmd_mkclean(pmd); -- 2.11.0