Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1588487pxb; Wed, 30 Mar 2022 06:40:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyv59h+aZfATNaDGP5zoSishiT32oVvpmpU2osT+9RivPxOyQaoEGwVv2PdWYyTzuWx0V3j X-Received: by 2002:a17:902:d482:b0:154:6f46:a602 with SMTP id c2-20020a170902d48200b001546f46a602mr35160730plg.155.1648647619863; Wed, 30 Mar 2022 06:40:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648647619; cv=none; d=google.com; s=arc-20160816; b=cOS9Rgf5xWgarJjF9aXVFDuWlmKx/RZ4TJveF6EBKuYqpojGvYVo0LxAtFkFyGHAVQ 9msedfjw2vAkSpYTp8hz7nvfHyAcw317jXQTFk6fzMjo9UJJ1AAdl/LUoPVNqyAsYpcb m/FFDMvmzl1mV8Skhwql9U6tPTqh8g++260bevlwWu+PrXQ7ZyNJ4ZF97BoPpDgZpnnF FJVhF7Q6X905eBkf9682PS0qmq8w5vQeXyZLIA8lxBU6HS5AlMTGNEltOR15KF5Sr+lp ZR0KhyPvKwwYrdx1ZlBM4EqOpS9K88f188cBSgpUVNtY48rorVWrJjr1LEA8ALaygcQU Bpyw== 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=Xp6qCxwTnE0C1FxChih956SdBv3W6L+dQXT7C0J3Dts=; b=DyWOqMjHdDsi02VU2c7QDlpr5gR2pFbXPU/erOoC3AXDUbXcy5Nqs7TzFnas9Tglxa GSQ69pjwuIXOKEHfxD3qGvL2PSCgmlm7azER/+TgrT4+Li/pXG/Rh+fMebyoVD2BTeYH lQoZ1KqoK/uuc+hYhP0PFEv5BN0jZhs5FIEdqe5M8ZhwVzk33UrPZLJLyvLldZ3uSQzU 8gnqcl0USDMv+IEnxN5CSlwKfm+mU+IozDE1BqAzbjtBh8iHTEG0tH4kOg/aFvwvtw4s QmW9qS9qTihbeClv2ApuxcLEIDzfoFvQGJXGw12Lcwm1bwGTTv+FpHV49jkylmIQd4Ca cn1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=7dvqFGIZ; 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 h12-20020a170902f54c00b00153b2d1643asi23928553plf.66.2022.03.30.06.40.05; Wed, 30 Mar 2022 06:40:19 -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=7dvqFGIZ; 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 S237510AbiC2Nv1 (ORCPT + 99 others); Tue, 29 Mar 2022 09:51:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237500AbiC2NvZ (ORCPT ); Tue, 29 Mar 2022 09:51:25 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EEEC9A9BB for ; Tue, 29 Mar 2022 06:49:42 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id d30so456547pjk.0 for ; Tue, 29 Mar 2022 06:49:42 -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=Xp6qCxwTnE0C1FxChih956SdBv3W6L+dQXT7C0J3Dts=; b=7dvqFGIZamDh6z2A7HqI+S0QNO4F3ZMglCOrx6y5hhx5QhuJeI8ofBVTiND7e6IZ2V m3lUYzObTIB/gdTZFA4KQD4DVsVBtwZ8tSMWVw+36xNQvtuPiVUrYb0u+Y3+2lro1C/F zPYEz7Vt8YKGhinn+4PXZ3dukjN0B1MbiKgtAlv1rGMO4ZQpvr71RTKO76fB44QtchOm abY0vvsDPKb/HSm86BzJ17VHR5e2mrLwsVZuC/1Ttk6sY1o74EUfeVjNCyd0bQ7PiVCl 3BXyud3hnwNvDSI2kGuWLZy+j235vtliI5g0/WHD/uaa16qqBriGcKHkz9VNYKXowtrs NR9A== 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=Xp6qCxwTnE0C1FxChih956SdBv3W6L+dQXT7C0J3Dts=; b=S7gR+SfGn2gSDTFR0qIoSkyt5kHhxU2VJD8reCnO5jbMka6LT9zMP0jTlmRxdpDCnP hI9RAFUQQrYKm4dDZ8AWJu59dPA8RI4lpNFCi+FqnUgQ/fJ3ufbIa0KG386HTzRUWwUy 0GgSNoNfLa8t79mlnpNZ7A/bWw/F6W4H5sUiMTCOJWVlFlXalZH3M0OBYfujFqYfxp4E NmYIG8rqM6lKFjKD0VD5zePSFWlwT7Osxk+ZZWV8nHZVk+YYUZzDU/j0udztIzS16lZk YYeuk1Pb6eWZnJFLl4xcdR0a8svIJrVjZHeUGYhszbZKok8Eq25WpGnMT1I2WRjd+5Nz JaHA== X-Gm-Message-State: AOAM530MVY2FpaXBtyY1XIVO/lKZ316XXIeQRzFbxiRzC0JyWJehJjwv gDGKp6D/0PCZmKsVtA4Ag4J6ew== X-Received: by 2002:a17:903:32c7:b0:154:19dd:fd43 with SMTP id i7-20020a17090332c700b0015419ddfd43mr31879012plr.150.1648561782107; Tue, 29 Mar 2022 06:49:42 -0700 (PDT) Received: from FVFYT0MHHV2J.bytedance.net ([139.177.225.239]) by smtp.gmail.com with ESMTPSA id o14-20020a056a0015ce00b004fab49cd65csm20911293pfu.205.2022.03.29.06.49.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Mar 2022 06:49:41 -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 , Christoph Hellwig Subject: [PATCH v6 1/6] mm: rmap: fix cache flush on THP pages Date: Tue, 29 Mar 2022 21:48:48 +0800 Message-Id: <20220329134853.68403-2-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220329134853.68403-1-songmuchun@bytedance.com> References: <20220329134853.68403-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=unavailable 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 Reviewed-by: Christoph Hellwig --- 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