Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2028649pxp; Fri, 18 Mar 2022 01:08:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyODskQ7cwvB09JcmU7SyCYT5UVQm5i1gj8hvI89h7UNp9RIBAShLWUwmrG2aciwdhk1oHW X-Received: by 2002:a63:e0a:0:b0:380:fba9:f6e4 with SMTP id d10-20020a630e0a000000b00380fba9f6e4mr6794743pgl.481.1647590914043; Fri, 18 Mar 2022 01:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647590914; cv=none; d=google.com; s=arc-20160816; b=uFXXGO2SNjghYihYC3fHJ82KpcKLjAFvgKSUZ29GnAKnHol9YunchG0VQC3OSd4oHO Xrqqp/0fa9iFDSD/2uQb3I8lp14YxesI1VUHgfD/MFPVPFnXU2CUkP5NUoKNQ/rz6Wt6 hBN1/oJK/A9f1JihmTRvNTCIb5bi6UZMVVyVTrPqjtHDUJF8YCPzanb1mDAzF6QX27Th UqTnjvbbY/N3Yti7HoGsgA55GSGifBulz8wulgqs1DeblMqKE8pi4nNSfhFnPrkBp9O9 XW9OlQjh1F4cM2RkxhCN0ZgLdeJIk0aVsF6+NbGr+U2WFpXyW8ueHpD2tvUYPtV31+tB N/yQ== 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=bccyIuXNgVgWTsjz+RBd2YEFs26+BYj7DbFQevsUcHE=; b=zQrArZziaXMWD7ce13EFirUx/mgK3Ut+X6jz1WtAfXHd14h6XFUFc3DZHKVWdDvDTn q7/lje+2UzB7p91YdiBQ2qNLfRV8IKl22WMOW1EKL3giRYSlxuFv1RX7S7F4I+Okc9K0 QQWdqCkOTLSdn/OLMTBcCZe/2InVSw5FeyB8qNhGOEL6+Ib97CKRFuUiVG89TL/iTmI9 K8E5fOfyOAPot0AXqI5LwyHab/RqRQVLz21XKsjmWKKf0U75c2dC/vwEF/bsQHrlau6B QrMj4kdQ4S0iFpvZJxAECc5nMlKZszrR5Cjju1DfNHAk4s6lvKkj20Nv34YUVfqHTaQI YtkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=ktwgzcqd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 16-20020a17090a1a1000b001c638bda95bsi4515036pjk.6.2022.03.18.01.08.22; Fri, 18 Mar 2022 01:08:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=ktwgzcqd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233268AbiCRHss (ORCPT + 99 others); Fri, 18 Mar 2022 03:48:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233256AbiCRHsr (ORCPT ); Fri, 18 Mar 2022 03:48:47 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F07502BAE74 for ; Fri, 18 Mar 2022 00:47:27 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id q1-20020a17090a4f8100b001c6575ae105so5165051pjh.0 for ; Fri, 18 Mar 2022 00:47:27 -0700 (PDT) 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=bccyIuXNgVgWTsjz+RBd2YEFs26+BYj7DbFQevsUcHE=; b=ktwgzcqdcBQJ1VBS2U8dc8HWvMuXzX7CD5ssYWniZs0fpuGzRFxB1aStyFCE16xcf6 bcRfs6g0fk+CWkXNzt6qW0s/4Q23/4jyHcZIq72vUBXRSN4mI6my0+E3RHhk6p16z+qP 1KpeJB4aEPeXiEEgTskBN+kSgEOBSnQdHPesRKu6XQOAcIwTpDHh9GMkta7O1zDayXsm xqK3CcRPDjTvqUC3Ubi+eoVjJYhQrYRRzqjhy/v14B2DJRPNWrQjrLwzgIm/1O6bL6Um zSRSXHAWTNtfm08hQ62lXI7xgcKxzgxlar1CtPWd3dyB5eCwhROhwdwPEj4FQIDlG+2i 1IAw== 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=bccyIuXNgVgWTsjz+RBd2YEFs26+BYj7DbFQevsUcHE=; b=4uCxAxJg4q3KE++cmMok4/RU9S3RO1M/w7UeqP7EvZkMm+HujKgO8YuECtBzMbLT5H R9KOCHTaDwuasqpdcwwTyT/XoQ5Xp2o5Xk25SCURCeMjpOHuotZxuMATeQAGlZBKh1SS Q/lzYRnBi+8BsxP2RTusLYHXs7tbXPo7wDDbILzVrCfZzrRpsZcw33evwcg8VcvO09Kx WVzwlfoP8yUAPBnWXmw8HWNHMRwocXy0i4A+3xIrnHITzRjAz3uufWpJXtJFI9mPNwtq X2fWAK/BdK3cllk02pOFF7GxZRAQsHeQzZxe9a0dlF8yt3i0B1swcFHn5TWF+adSFf3l JLcw== X-Gm-Message-State: AOAM533T6OmGswzVRqvWEYHHVMli0IIeVK8hNZu+ZGsVW0TIQEsx95Ft +Lu6nli710OMti/0U24TQ75NpQ== X-Received: by 2002:a17:90b:1bc3:b0:1bf:7461:7838 with SMTP id oa3-20020a17090b1bc300b001bf74617838mr20460132pjb.3.1647589647396; Fri, 18 Mar 2022 00:47:27 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.233]) by smtp.gmail.com with ESMTPSA id a38-20020a056a001d2600b004f72acd4dadsm8770941pfx.81.2022.03.18.00.47.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Mar 2022 00:47:27 -0700 (PDT) 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 v5 1/6] mm: rmap: fix cache flush on THP pages Date: Fri, 18 Mar 2022 15:45:24 +0800 Message-Id: <20220318074529.5261-2-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220318074529.5261-1-songmuchun@bytedance.com> References: <20220318074529.5261-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,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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. At least, no problems were found due to this. Maybe because the architectures that have virtual indexed caches is less. Fixes: f27176cfc363 ("mm: convert page_mkclean_one() to use page_vma_mapped_walk()") Signed-off-by: Muchun Song Reviewed-by: Yang Shi Reviewed-by: Dan Williams --- mm/rmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/rmap.c b/mm/rmap.c index fc46a3d7b704..723682ddb9e8 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -970,7 +970,8 @@ static bool page_mkclean_one(struct folio *folio, struct vm_area_struct *vma, if (!pmd_dirty(*pmd) && !pmd_write(*pmd)) continue; - flush_cache_page(vma, address, folio_pfn(folio)); + flush_cache_range(vma, address, + address + HPAGE_PMD_SIZE); entry = pmdp_invalidate(vma, address, pmd); entry = pmd_wrprotect(entry); entry = pmd_mkclean(entry); -- 2.11.0