From: SeongJae Park <sj@kernel.org>
To: Usama Arif <usamaarif642@gmail.com>
Cc: SeongJae Park <sj@kernel.org>,
akpm@linux-foundation.org, damon@lists.linux.dev,
linux-mm@kvack.org
Subject: Re: [PATCH] mm/damon: increment pa_stat damon address range by folio size
Date: Mon, 13 Jan 2025 11:04:05 -0800 [thread overview]
Message-ID: <20250113190405.6723-1-sj@kernel.org> (raw)
In-Reply-To: <8892b42c-3363-4fdf-ad3c-4bbd2a0a801b@gmail.com>
On Mon, 13 Jan 2025 18:53:32 +0000 Usama Arif <usamaarif642@gmail.com> wrote:
>
>
> On 13/01/2025 18:43, SeongJae Park wrote:
> > Hi Usama,
> >
> >
> > Let's use "mm/damon/paddr: " prefix for the patch title, to be more consistent
> > with others.
> >
> > On Mon, 13 Jan 2025 18:03:40 +0000 Usama Arif <usamaarif642@gmail.com> wrote:
> >
> >> This is to take into account for folios with size > 1 page.
> >> Iterating at PAGE_SIZE increment would increment sz_filter_passed
> >> multiple times for the same folio by folio_size, providing incorrect
> >> stats.
> >
> > damon_get_folio() returns NULL if the page is a tail page. Hence I think it
> > will not increment sz_filter_passed multiple times?
>
> ahh I didn't look at the definition of damon_get_folio! just assumed it will get
> the folio irrespective of if its a tail page or not. Will change the commit message.
>
> Just curious if returning NULL is what is expected by the user?
> I see damon_get_folio used in a bunch a places. If the user limits damos action/
> damon monitoring to a specific address range, and that covers some of the tail pages,
> but not the head page, I guess the damos action wont be applied.
Yes, I think damon_get_folio() users (mostly DAMON operations set layer) should
aware that and use different functions if it can be a problem, depending on
each case. I find no problematic use cases of the function off the top of my
head, but if you find, please help us fixing those :)
[...]
> >> diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
> >> index 6b4397de4199..cc789a97c6f5 100644
> >> --- a/mm/damon/paddr.c
> >> +++ b/mm/damon/paddr.c
> >> @@ -504,7 +504,8 @@ static unsigned long damon_pa_stat(struct damon_region *r, struct damos *s,
> >> if (!damon_pa_scheme_has_filter(s))
> >> return 0;
> >>
> >> - for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) {
> >> + addr = r->ar.start;
> >> + while (addr < r->ar.end) {
> >> struct folio *folio = damon_get_folio(PHYS_PFN(addr));
> >>
> >> if (!folio)
> >
> > In this case, the code does "continue". 'addr' is not advanced, so it will
> > result in an infinite loop. Let's do 'addr += PAGE_SIZE' here, to avoid that.
>
> Thanks! Will fix this in v2.
Nice, looking forward to it!
Thanks,
SJ
[...]
prev parent reply other threads:[~2025-01-13 19:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 18:03 [PATCH] mm/damon: increment pa_stat damon address range by folio size Usama Arif
2025-01-13 18:43 ` SeongJae Park
2025-01-13 18:53 ` Usama Arif
2025-01-13 19:04 ` 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=20250113190405.6723-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-mm@kvack.org \
--cc=usamaarif642@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.