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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D14CEC433EF for ; Thu, 16 Dec 2021 08:00:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 203A26B0071; Thu, 16 Dec 2021 02:59:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B3996B0073; Thu, 16 Dec 2021 02:59:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A2C06B0074; Thu, 16 Dec 2021 02:59:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id EEABB6B0071 for ; Thu, 16 Dec 2021 02:59:54 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B2081181AC9CC for ; Thu, 16 Dec 2021 07:59:44 +0000 (UTC) X-FDA: 78922908288.14.DB8D602 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf24.hostedemail.com (Postfix) with ESMTP id 913B318000E for ; Thu, 16 Dec 2021 07:59:41 +0000 (UTC) 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 4FBA8B822EF; Thu, 16 Dec 2021 07:59:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8131CC36AE4; Thu, 16 Dec 2021 07:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639641581; bh=omnGAeU3p0/fbX8DlE1y1+PuwXB/KVJvrTZr3uD9Lso=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=dCKxrF4SrDa/CL3bibQelTisj8hHKtuhvNXbQYFEomvk24sY96tvipt1jufeTUhdD VuVDlnSUDudswFVIo+uLJfWBgCSRGzeIgr7SUiX8qvhygBZCHYNj0hRTJn/kvIGB5r QR0UhL0c/soU/Uf8gnzif/AeR0gluUI+6TvnZKbskSzFRN5O7p28ev3xfmKCbd2Mow CdnwgQUqrj59YW362hkocGUncf9TUnr7ZcoixiilDV4zgpCwfrfJmj65KS6XiGhQIW HtdHgSSrog0ipjPRSmm/pPQMe97hbOYlKFy6BZs7g9ClqFZcQwLBjICFkI29o9Zf6X 8rge9HKHTByPA== From: SeongJae Park To: Baolin Wang Cc: SeongJae Park , akpm@linux-foundation.org, mike.kravetz@oracle.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/damon: Add access checking for hugetlb pages Date: Thu, 16 Dec 2021 07:59:36 +0000 Message-Id: <20211216075936.4598-1-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 913B318000E X-Stat-Signature: yojqj6d8zusioohy6wuq9rsrm4wm4fy3 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=dCKxrF4S; spf=pass (imf24.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-HE-Tag: 1639641581-248616 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: On Thu, 16 Dec 2021 09:23:13 +0800 Baolin Wang wrote: > Hi, > > On 12/16/2021 1:16 AM, SeongJae Park wrote: > > On Wed, 15 Dec 2021 23:23:25 +0800 Baolin Wang wrote: > > > >> The process's VMAs can be mapped by hugetlb page, but now the DAMON > >> did not implement the access checking for hugetlb pte, so we can not > >> get the actual access count like below if a process VMAs were mapped > >> by hugetlb. > >> > >> damon_aggregated: target_id=18446614368406014464 > >> nr_regions=12 4194304-5476352: 0 545 [...] > >> > >> Thus this patch adds hugetlb access checking support, with this patch > >> we can see below VMA mapped by hugetlb access count. > >> > >> damon_aggregated: target_id=18446613056935405824 > >> nr_regions=12 140296486649856-140296489914368: 1 3 [...] > >> diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c > >> index 78ff2bc..ee116e5 100644 > >> --- a/mm/damon/vaddr.c > >> +++ b/mm/damon/vaddr.c > >> @@ -14,6 +14,7 @@ > >> #include > >> #include > >> #include > >> +#include > >> > >> #include "prmtv-common.h" > >> > >> @@ -386,8 +387,33 @@ static int damon_mkold_pmd_entry(pmd_t *pmd, unsigned long addr, > >> return 0; > >> } > >> > >> +#ifdef CONFIG_HUGETLB_PAGE > >> +static int damon_mkold_hugetlb_entry(pte_t *pte, unsigned long hmask, > >> + unsigned long addr, unsigned long end, > >> + struct mm_walk *walk) > >> +{ > >> + struct hstate *h = hstate_vma(walk->vma); > >> + spinlock_t *ptl; > >> + pte_t entry; > >> + > >> + ptl = huge_pte_lock(h, walk->mm, pte); > >> + entry = huge_ptep_get(pte); > > > > Could we do above assignments in the variables definitions? > > Since we need get the hugetlb pte under the pte lock, I still perfer to > declare the lock region explicitly in the code instead in the variables > definitions. Ok, that makes sense. [...] > >> +#ifdef CONFIG_HUGETLB_PAGE > >> +static int damon_young_hugetlb_entry(pte_t *pte, unsigned long hmask, > >> + unsigned long addr, unsigned long end, > >> + struct mm_walk *walk) > >> +{ > >> + struct damon_young_walk_private *priv = walk->private; > >> + struct hstate *h = hstate_vma(walk->vma); > >> + struct page *page; > >> + spinlock_t *ptl; > >> + pte_t entry; > >> + > >> + ptl = huge_pte_lock(h, walk->mm, pte); > >> + entry = huge_ptep_get(pte); > > > > Could we do these assignments in the above variables definitions? > > Ditto. Again, agreed. > > Thanks for your comments. My pleaseure! Thanks, SJ