Re: [PATCH] damon: Use pmdp_get instead of drect dereferencing pmd.

From: Yun Levi
Date: Thu Jul 27 2023 - 17:16:06 EST


Hi SJ.

Thanks for looking into this.

> Nit for the subject, what about s/drect/directly/? Also, let's remove the
> period at the end.
>
> On Fri, 28 Jul 2023 03:37:45 +0900 Levi Yun <ppbuk5246@xxxxxxxxx> wrote:

Thanks. But I don't know why period is added thou I sent via git send-email ..

> > - if (pmd_trans_huge(*pmd)) {
> > + if (pmd_trans_huge(pmdp_get_lockless(pmd))) {
>
> I don't think we really need to use pmdp_get_lockless() here, since we will do
> this check again with the lock, and we have the fallback for the intermediate
> changes.

Agree. I'll change. Thanks :)

> > @@ -434,26 +437,29 @@ static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr,
> > {
> > pte_t *pte;
> > pte_t ptent;
> > + pmd_t pmde;
>
> This would cause below build warning if CONFIG_TRANSPARENT_HUGEPAGE is not
> defined.
>
> .../mm/damon/vaddr.c:440:8: warning: unused variable 'pmde' [-Wunused-variable]
> 440 | pmd_t pmde;
> | ^~~~
>
>
> > spinlock_t *ptl;
> > struct folio *folio;
> > struct damon_young_walk_private *priv = walk->private;
> >
> > #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> > - if (pmd_trans_huge(*pmd)) {
> > + if (pmd_trans_huge(pmdp_get_lockless(pmd))) {

Oh.. I miss this. Many thanks..!

> Thanks,
> SJ

Many Thanks..!

---------
Sincerely,
Levi.