From patchwork Wed Apr 27 10:52:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 12828596 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 B347CC433F5 for ; Wed, 27 Apr 2022 10:52:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3CCC46B0071; Wed, 27 Apr 2022 06:52:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 37C4C6B0072; Wed, 27 Apr 2022 06:52:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26A326B0073; Wed, 27 Apr 2022 06:52:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 170A16B0071 for ; Wed, 27 Apr 2022 06:52:19 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id DAE1526D4 for ; Wed, 27 Apr 2022 10:52:18 +0000 (UTC) X-FDA: 79402344756.29.992F1E9 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by imf12.hostedemail.com (Postfix) with ESMTP id BC69140046 for ; Wed, 27 Apr 2022 10:52:07 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VBSxH7t_1651056733; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VBSxH7t_1651056733) by smtp.aliyun-inc.com(127.0.0.1); Wed, 27 Apr 2022 18:52:13 +0800 From: Baolin Wang To: akpm@linux-foundation.org, mike.kravetz@oracle.com Cc: almasrymina@google.com, songmuchun@bytedance.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/3] Fix cache flush issues considering PMD sharing Date: Wed, 27 Apr 2022 18:52:04 +0800 Message-Id: X-Mailer: git-send-email 1.8.3.1 Authentication-Results: imf12.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf12.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.131 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: BC69140046 X-Rspam-User: X-Stat-Signature: tg15swz1j4964m9rejeksgtt3qsgzpqo X-HE-Tag: 1651056727-332667 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: Hi, This patch set fixes some cache flushing issues if PMD sharing is possible for hugetlb pages, which were found by code inspection. Meanwhile Mike found the flush_cache_page() can not cover the whole size of a hugetlb page on some architectures [1], so I added a new patch 3 to fix this issue, since I found only try_to_unmap_one() and try_to_migrate_one() need to fix after some investigation. Please help to review. Thanks. [1] https://lore.kernel.org/linux-mm/064da3bb-5b4b-7332-a722-c5a541128705@oracle.com/ Changes from v1: - Add reviewed-by tag from Mike. - Update some comments suggested by Mike. - Add a new patch to fix cache issue for hugetlb page. Baolin Wang (3): mm: hugetlb: Considering PMD sharing when flushing cache/TLBs mm: rmap: Move the cache flushing to the correct place for hugetlb PMD sharing mm: rmap: Use flush_cache_range() to flush cache for hugetlb pages mm/hugetlb.c | 17 ++++++++- mm/mremap.c | 2 +- mm/rmap.c | 118 ++++++++++++++++++++++++++++++++--------------------------- 3 files changed, 80 insertions(+), 57 deletions(-)