From: Dave Hansen <dave.hansen@intel.com>
To: Aravinda Prasad <aravinda.prasad@intel.com>,
damon@lists.linux.dev, linux-mm@kvack.org, sj@kernel.org,
linux-kernel@vger.kernel.org
Cc: s2322819@ed.ac.uk, sandeep4.kumar@intel.com,
ying.huang@intel.com, dan.j.williams@intel.com,
sreenivas.subramoney@intel.com, antti.kervinen@intel.com,
alexander.kanevskiy@intel.com, Alan Nair <alan.nair@intel.com>
Subject: Re: mm/DAMON: Profiling enhancements for DAMON
Date: Fri, 15 Dec 2023 10:10:08 -0800 [thread overview]
Message-ID: <99ce13b6-600d-411e-9dab-97a8ed166deb@intel.com> (raw)
In-Reply-To: <20231215074619.173787-1-aravinda.prasad@intel.com>
On 12/14/23 23:46, Aravinda Prasad wrote:
> +static int damon_young_pmd(pmd_t *pmd, unsigned long addr,
> + unsigned long next, struct mm_walk *walk)
> +{
> + spinlock_t *ptl;
> + struct damon_young_walk_private *priv = walk->private;
> +
> + if (!pmd_present(*pmd) || pmd_none(*pmd))
> + goto out;
> +
> + ptl = pmd_lock(walk->mm, pmd);
> + if (pmd_young(*pmd) || mmu_notifier_test_young(walk->mm, addr))
> + priv->young = true;
> +
> + *priv->folio_sz = (1UL << PMD_SHIFT);
> + spin_unlock(ptl);
> +out:
> + return 0;
> +}
There are a number of paired p*_present() and p_*none() checks in this
patch. What is their function (especially pmd_none())? For instance,
damon_young_pmd() gets called via the pagewalk infrastructure:
> static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end,
> struct mm_walk *walk)
> {
...
> next = pmd_addr_end(addr, end);
> if (pmd_none(*pmd)) {
...
> continue;
> }
...
> if (ops->pmd_entry)
> err = ops->pmd_entry(pmd, addr, next, walk);
I'd suggest taking a closer look at the code you are replacing and other
mm_walk users to make sure the handlers are doing appropriate checks.
next prev parent reply other threads:[~2023-12-15 18:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-15 7:46 Aravinda Prasad
2023-12-15 8:33 ` Yu Zhao
2023-12-15 10:07 ` Prasad, Aravinda
2023-12-16 5:41 ` Yu Zhao
2023-12-18 11:32 ` Prasad, Aravinda
2023-12-15 18:10 ` Dave Hansen [this message]
2023-12-18 11:41 ` Prasad, Aravinda
2023-12-15 20:11 ` SeongJae Park
2023-12-18 13:05 ` Prasad, Aravinda
2024-02-26 6:09 罗午阳
2024-03-04 1:54 罗午阳
2024-03-04 6:23 ` Prasad, Aravinda
2024-03-04 6:26 ` Prasad, Aravinda
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=99ce13b6-600d-411e-9dab-97a8ed166deb@intel.com \
--to=dave.hansen@intel.com \
--cc=alan.nair@intel.com \
--cc=alexander.kanevskiy@intel.com \
--cc=antti.kervinen@intel.com \
--cc=aravinda.prasad@intel.com \
--cc=damon@lists.linux.dev \
--cc=dan.j.williams@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=s2322819@ed.ac.uk \
--cc=sandeep4.kumar@intel.com \
--cc=sj@kernel.org \
--cc=sreenivas.subramoney@intel.com \
--cc=ying.huang@intel.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