From: SeongJae Park <sj@kernel.org>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: SeongJae Park <sj@kernel.org>,
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 [thread overview]
Message-ID: <20211216075936.4598-1-sj@kernel.org> (raw)
In-Reply-To: <c4caa17a-a071-b253-0362-6dddfa1a548f@linux.alibaba.com>
On Thu, 16 Dec 2021 09:23:13 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> wrote:
> Hi,
>
> On 12/16/2021 1:16 AM, SeongJae Park wrote:
> > On Wed, 15 Dec 2021 23:23:25 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> 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 <linux/page_idle.h>
> >> #include <linux/pagewalk.h>
> >> #include <linux/sched/mm.h>
> >> +#include <linux/hugetlb.h>
> >>
> >> #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
prev parent reply other threads:[~2021-12-16 8:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 15:23 [PATCH] mm/damon: Add access checking for hugetlb pages Baolin Wang
2021-12-15 17:16 ` SeongJae Park
2021-12-16 1:23 ` Baolin Wang
2021-12-16 7:59 ` SeongJae Park [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211216075936.4598-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).