Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4472205ioa; Wed, 27 Apr 2022 04:44:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXoVPB/4h7I43AOD2KCc1NWSX9XDGcEj24+K4HMjIaAITYlwonC3KXtOM0lmgEvHxtSaj4 X-Received: by 2002:a17:902:eb83:b0:15d:2e0f:a6f with SMTP id q3-20020a170902eb8300b0015d2e0f0a6fmr10165594plg.165.1651059898490; Wed, 27 Apr 2022 04:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651059898; cv=none; d=google.com; s=arc-20160816; b=CUv73tNOEDMplnU9gv8Dy6obiiiCNlEbmELdkBCQsULnft9NyiNBuIg+oHqeD6hjWj tTcky2JU94MRfYPjEh+P0nh1odnXqXnPwac34hAYNBhdT6hTX2mi5Y6thavU/+AQ1lM1 YISDBDIovGyT4OIuBVxGaDkQ4dyCUoLdaRVCUBNz7NVbz0tIo1n3WfEHOAl5eSVPSk+o 4PTAHA4gJevMnbDU/ydqpUtyqQ/RZFZPOykbSR9aZ6sVIXpRygx6RQhf1WtU/WskSRWC KRvcsOcMjq+iuqTJLtMvWka0TK4uFpjnsK7WDLm4FKklg5PeFQ0AWNj+XqLXjH0XdFVX W1Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=UsjyYCnumoWQWsa72MzY/IxafMm2+STuOW/9xu08Owc=; b=Y/cP3SWJt3X9FKx+ls5WeBwIYbnhtW3eaiVA5MJnjlIriSJLGcEpPT54WISs+oP7El JAUPIAafHHmxBYVGcW5cmUXfC7dGg6lu2KBy4d+NVLtwy6QhlILQtbfRlMRbQels0fay pSq2XSFWqLtZTCqTP+V9QpVbm4zD/KoJXxt5HQ855b77ZZ4Pr6BPJ2BkZp04Wcu6SH0b 9Kl6P98Y1+uYjdUkHY4nhXcSsTaGbBJKLFoJWJtQq46lYlU/ug4aLUS+lsKQ348i/viR DV8BJofLTmsT62Wb8oNHVziWpFapHY6rE/KOQmEDpgFhr1SSr38YRKsXP0ps0ExsxvBZ eDrg== ARC-Authentication-Results: i=1; mx.google.com; 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=alibaba.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j70-20020a638b49000000b003a9eb7ed002si1263368pge.280.2022.04.27.04.44.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 04:44:58 -0700 (PDT) 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; 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=alibaba.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7C1C61E41CA; Wed, 27 Apr 2022 04:02:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231558AbiD0LFo (ORCPT + 99 others); Wed, 27 Apr 2022 07:05:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232174AbiD0LDa (ORCPT ); Wed, 27 Apr 2022 07:03:30 -0400 Received: from out30-45.freemail.mail.aliyun.com (out30-45.freemail.mail.aliyun.com [115.124.30.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7B983EDABC for ; Wed, 27 Apr 2022 03:52:16 -0700 (PDT) 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,UNPARSEABLE_RELAY 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 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(-) -- 1.8.3.1