Received: by 2002:a19:651b:0:0:0:0:0 with SMTP id z27csp3646867lfb; Mon, 9 May 2022 00:43:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVx2GIrnKKL0Ww4Qs1kY79+PISxvxJOKzDq0bMlyhR03ZR1u1P0QvAcZBOmIufQ2NIL8A+ X-Received: by 2002:a63:2a0d:0:b0:3ab:392c:f45c with SMTP id q13-20020a632a0d000000b003ab392cf45cmr12199776pgq.575.1652082228094; Mon, 09 May 2022 00:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652082228; cv=none; d=google.com; s=arc-20160816; b=UGBlw7jx1NNcyMrXJw4chcg2h97QYyjxMgSZWRAWx6LLotRak45C7FVek0bjdmkO4Z b9Jbuiz4iRVF4UeCrthHUX3oYjlXQaFgn0mbHLE0dIepH/5pIYx+t/5JhD+nEuyUl6ju 5XDJMPmbYHQ+x3UidXN2wUV6TzK2klNf8fjDfNBKv/tMQKOJ3OmaKcEdcbUO0Bqa3w/x VprxX7WgCUl1XNU9YQbRxANgScGzCNKwqU+vxLPD3qq4N2TDWkvjSF7Gy3fQQLFnR0kq POS4gqL3kfBvcb0EHrlTTEZW8974h8SpXf6xEuVuAXaCCW4oRVL9kW5BjPEq88QmCxEU jb1A== 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=SaZ393fKN6UmP22c2k34GFn6zfOwGRjQY3jR8u5g2PA=; b=OhYHE2fHIpgWsXs6i7OPy8bRf9r6iwSBB5VjI2U69WjhrHrYJ7UGJtTYg9BLMB39fO Zz+qNL/V1rIgtbVLXAFwyHVrv5C5W7/LseD8FvrzdbYMUEzcQR+7vY8dfWYis/6Aa4y0 JrLE1fYNuTp+hl0EBhhLbs7+yCdVNFdUw6+PGYITxjhTBiTOivJi1Pktqf6QUMGckWoM V3dbOVCvkpcnBJaZBP1eLr4d+ZBEeRIZJTPMytixZqSeQfuTVzGD0ir/EKob/+suxdxV oVe6hi8EGhmWQjhrTQmlfL7y31PmWSpPFN/OI3kdc7k8HrZcLDHt6m2Zx47YKJocOz6d xGUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id fr8-20020a17090ae2c800b001d990236c87si11790372pjb.55.2022.05.09.00.43.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 00:43:48 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 DF14F149ABE; Mon, 9 May 2022 00:37:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231368AbiEHJC7 (ORCPT + 99 others); Sun, 8 May 2022 05:02:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229897AbiEHJC5 (ORCPT ); Sun, 8 May 2022 05:02:57 -0400 Received: from out30-57.freemail.mail.aliyun.com (out30-57.freemail.mail.aliyun.com [115.124.30.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1EEDBCB7; Sun, 8 May 2022 01:59:06 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R761e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0VCZqsya_1652000343; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VCZqsya_1652000343) by smtp.aliyun-inc.com(127.0.0.1); Sun, 08 May 2022 16:59:04 +0800 From: Baolin Wang To: catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, mike.kravetz@oracle.com, akpm@linux-foundation.org, sj@kernel.org Cc: baolin.wang@linux.alibaba.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 0/3] Introduce new huge_ptep_get_access_flags() interface Date: Sun, 8 May 2022 16:58:51 +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,T_SCC_BODY_TEXT_LINE,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, As Mike pointed out [1], the huge_ptep_get() will only return one specific pte value for the CONT-PTE or CONT-PMD size hugetlb on ARM64 system, which will not take into account the subpages' dirty or young bits of a CONT-PTE/PMD size hugetlb page. That will make us miss dirty or young flags of a CONT-PTE/PMD size hugetlb page for those functions that want to check the dirty or young flags of a hugetlb page. For example, the gather_hugetlb_stats() will get inaccurate dirty hugetlb page statistics, and the DAMON for hugetlb monitoring will also get inaccurate access statistics. To fix this issue, one approach is that we can define an ARM64 specific huge_ptep_get() implementation, which will take into account any subpages' dirty or young bits. However we should add a new parameter for ARM64 specific huge_ptep_get() to check how many continuous PTEs or PMDs in this CONT-PTE/PMD size hugetlb, that means we should convert all the places using huge_ptep_get(), meanwhile most places using huge_ptep_get() did not care about the dirty or young flags at all. So instead of changing the prototype of huge_ptep_get(), this patch set introduces a new huge_ptep_get_access_flags() interface and define an ARM64 specific implementation, that will take into account any subpages' dirty or young bits for CONT-PTE/PMD size hugetlb page. And we can only change to use huge_ptep_get_access_flags() for those functions that care about the dirty or young flags of a hugetlb page. [1] https://lore.kernel.org/linux-mm/85bd80b4-b4fd-0d3f-a2e5-149559f2f387@oracle.com/ Baolin Wang (3): arm64/hugetlb: Introduce new huge_ptep_get_access_flags() interface fs/proc/task_mmu: Change to use huge_ptep_get_access_flags() mm/damon/vaddr: Change to use huge_ptep_get_access_flags() arch/arm64/include/asm/hugetlb.h | 2 ++ arch/arm64/mm/hugetlbpage.c | 24 ++++++++++++++++++++++++ fs/proc/task_mmu.c | 3 ++- include/asm-generic/hugetlb.h | 7 +++++++ mm/damon/vaddr.c | 5 +++-- 5 files changed, 38 insertions(+), 3 deletions(-) -- 1.8.3.1