From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34219C433EF for ; Tue, 19 Jul 2022 12:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241815AbiGSMu1 (ORCPT ); Tue, 19 Jul 2022 08:50:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241769AbiGSMss (ORCPT ); Tue, 19 Jul 2022 08:48:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CF898E1C8; Tue, 19 Jul 2022 05:19:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 445D9B81B1A; Tue, 19 Jul 2022 12:18:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9938EC341C6; Tue, 19 Jul 2022 12:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233137; bh=H2Kb4/sN5o+k5/06jEyvGqNLtfKnh+jjfO9cO4iOzDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vlNMb0bcVNFysG+Nfti0FegqZZxgkOxJz83QJDqqRl1B0DEe6tJ5GPmVuKLmoiSma YabW5Pb0RANWNX7xwrA4cwHh5KwD3O+ImmHxSy5JpT8x8wyh0YCgBfYF34AHZFlrY8 B8QKCQUP+Mm8IvbwFfDfvaQZCLJvEtXPPemhhxG0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baolin Wang , SeongJae Park , Mike Kravetz , Muchun Song , Andrew Morton Subject: [PATCH 5.18 019/231] mm/damon: use set_huge_pte_at() to make huge pte old Date: Tue, 19 Jul 2022 13:51:44 +0200 Message-Id: <20220719114715.615690833@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Baolin Wang commit ed1523a895ffdabcab6e067af18685ed00f5ce15 upstream. The huge_ptep_set_access_flags() can not make the huge pte old according to the discussion [1], that means we will always mornitor the young state of the hugetlb though we stopped accessing the hugetlb, as a result DAMON will get inaccurate accessing statistics. So changing to use set_huge_pte_at() to make the huge pte old to fix this issue. [1] https://lore.kernel.org/all/Yqy97gXI4Nqb7dYo@arm.com/ Link: https://lkml.kernel.org/r/1655692482-28797-1-git-send-email-baolin.wang@linux.alibaba.com Fixes: 49f4203aae06 ("mm/damon: add access checking for hugetlb pages") Signed-off-by: Baolin Wang Reviewed-by: SeongJae Park Acked-by: Mike Kravetz Reviewed-by: Muchun Song Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/damon/vaddr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/mm/damon/vaddr.c +++ b/mm/damon/vaddr.c @@ -407,8 +407,7 @@ static void damon_hugetlb_mkold(pte_t *p if (pte_young(entry)) { referenced = true; entry = pte_mkold(entry); - huge_ptep_set_access_flags(vma, addr, pte, entry, - vma->vm_flags & VM_WRITE); + set_huge_pte_at(mm, addr, pte, entry); } #ifdef CONFIG_MMU_NOTIFIER