From patchwork Fri Jan 21 07:55:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12719428 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 757A7C43219 for ; Fri, 21 Jan 2022 07:56:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A6506B0080; Fri, 21 Jan 2022 02:56:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0568F6B0081; Fri, 21 Jan 2022 02:56:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E86E46B0083; Fri, 21 Jan 2022 02:56:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay032.a.hostedemail.com [64.99.140.32]) by kanga.kvack.org (Postfix) with ESMTP id DA1D56B0080 for ; Fri, 21 Jan 2022 02:56:36 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id AB7772305B for ; Fri, 21 Jan 2022 07:56:36 +0000 (UTC) X-FDA: 79053537192.02.803802F Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf05.hostedemail.com (Postfix) with ESMTP id 16382100014 for ; Fri, 21 Jan 2022 07:56:35 +0000 (UTC) Received: by mail-pl1-f182.google.com with SMTP id d1so7651756plh.10 for ; Thu, 20 Jan 2022 23:56:36 -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=g85iyBrbQfGIa6oI3cy0UnhFSe/ynzyb0z74yUFTllk=; b=W4ZdDO/SKqbmtzYR/fK+Rrxosm61hwItSMOkaFU/2YX7icv3gLM22PlkNp8St7zagA UoHLQimZ796bnmN3njyvgHwul7SoNkSBEdJ9IG/MbFpKSoA2CAaUyjBax2geIygUt1g9 5ndWslIKU0n0WHiQQDf0T3KGUCK5lyBYsNRJj5bZ5/Hk/R8x7Des5mPQavrM+bQFF06Q yKfhRzFP1c0jCTWn8WNdLEm/dtLo6ZXu5MP+c19NS1mQPYcIl83IWtXuJrZLPJyFofHE oKTVP4jynRsJO4b7OajRDhEO6MGTZJHDYgYjZu38f6inX6lzKJNTofnei2qpVdCJ6XfQ /YKQ== 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=g85iyBrbQfGIa6oI3cy0UnhFSe/ynzyb0z74yUFTllk=; b=W+Kr/dUZDKUDBwsm4uS0vFDfPpO5dWLAcL2PuWi7sTvITtNqBq2zu3gQIj3QwNva8h QCnDjnsARoIGve4nEdBq5KRorvJfT4OfX+mPq13HffFFLKjJWQuFv+nZMgYU+dtLAE8/ wXUxOR/81B/zow+CIi8yZw8TjKXNhEcQ5fJlcIV0cQ8Zd57U8kYANOsFlafOJ/glGKWh wgEh0J8f+TRpC0nyN/0N5z4DRI31eBh9WGp/YY+9ajuWGTUmpgTw45pxr5PTgZ/O5SoA uD2zk1kBnp8wBJd3ZKAAvfQx1JCgErndsYKGUISMMceorEkkG1ZxAVfD2biiLk6rswaU gM/A== X-Gm-Message-State: AOAM5307+JkW2MerM2HNTrlfFkVjBFVfLb0dBSWcZDKtiHfKTnGyDxYL csG9MJJXW9Y9zc3ln+Bf5xakU+xfKQj1Bh8l X-Google-Smtp-Source: ABdhPJz6D9O2uvj40X0dQzDK5rSPcYK0+vGHyAMFzHzrHrk7fEsv1fTssN4tSehxXfv9S9hqt076Kg== X-Received: by 2002:a17:902:9894:b0:149:8a72:98ae with SMTP id s20-20020a170902989400b001498a7298aemr2720829plp.132.1642751795469; Thu, 20 Jan 2022 23:56:35 -0800 (PST) Received: from FVFYT0MHHV2J.tiktokcdn.com ([139.177.225.230]) by smtp.gmail.com with ESMTPSA id t15sm10778178pjy.17.2022.01.20.23.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 23:56:35 -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 Cc: linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Muchun Song Subject: [PATCH 2/5] dax: fix cache flush on PMD-mapped pages Date: Fri, 21 Jan 2022 15:55:12 +0800 Message-Id: <20220121075515.79311-2-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220121075515.79311-1-songmuchun@bytedance.com> References: <20220121075515.79311-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 16382100014 X-Stat-Signature: amo39c4zyzwcbs63fo119is7sp6m5wpa Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="W4ZdDO/S"; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf05.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Rspamd-Server: rspam06 X-HE-Tag: 1642751795-197335 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: 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/dax.c b/fs/dax.c index 88be1c02a151..2955ec65eb65 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -857,7 +857,7 @@ 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);