lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240224205453.47096-1-sj@kernel.org>
Date: Sat, 24 Feb 2024 12:54:52 -0800
From: SeongJae Park <sj@...nel.org>
To: Barry Song <21cnbao@...il.com>
Cc: SeongJae Park <sj@...nel.org>,
	Minchan Kim <minchan@...nel.org>,
	akpm@...ux-foundation.org,
	damon@...ts.linux.dev,
	linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	mhocko@...e.com,
	hannes@...xchg.org,
	Barry Song <v-songbaohua@...o.com>
Subject: Re: [PATCH RFC] mm: madvise: pageout: ignore references rather than clearing young

On Sun, 25 Feb 2024 04:01:40 +0800 Barry Song <21cnbao@...il.com> wrote:

> On Sun, Feb 25, 2024 at 3:07 AM SeongJae Park <sj@...nel.org> wrote:
> >
> > Hi Barry,
> >
> > On Sat, 24 Feb 2024 12:37:59 +0800 Barry Song <21cnbao@...il.com> wrote:
> >
> > [...]
> > >
> > > BTW,
> > > Hi SeongJae,
> > > I am not quite sure if damon also needs this, so I have kept damon as is by
> > > setting ignore_references = false.  MADV_PAGEOUT is an explicit hint users
> > > don't want the memory to be reclaimed, I don't know if it is true for damon as
> > > well. If you have some comments, please chime in.
> >
> > Thank you for calling my name :)
> >
> > For DAMON's usecase, the document simply says the behavior would be same to
> > MADV_PAGEOUT, so if we conclude to change MADV_PAGEOUT, I think same change
> > should be made for DAMON's usecase, or update DAMON document.
> 
> Hi SeongJae,
> 
> I don't find similar clearing pte young in damon_pa_pageout(), so i
> guess damon's
> behaviour is actually different with MADV_PAGEOUT which has  pte-clearing. damon
> is probably the best-effort but MADV_PAGEOUT isn't .
> 
> static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s)
> {
>         unsigned long addr, applied;
>         LIST_HEAD(folio_list);
> 
>         for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) {
>                      struct folio *folio = damon_get_folio(PHYS_PFN(addr));
>                      ....
> 
>                      if (damos_pa_filter_out(s, folio))
>                                 goto put_folio;
> 
>                     folio_clear_referenced(folio);
>                     folio_test_clear_young(folio);
>                     if (!folio_isolate_lru(folio))
>                          goto put_folio;
>                     if (folio_test_unevictable(folio))
>                           folio_putback_lru(folio);
>                     else
>                           list_add(&folio->lru, &folio_list);
> put_folio:
>                folio_put(folio);
>          }
>          applied = reclaim_pages(&folio_list);
>          cond_resched();
>          return applied * PAGE_SIZE;
> }
> 
> am i missing something?

Thank you for checking this again.  You're right.

Technically speaking, DAMON's usage of MADV_PAGEOUT is in vaddr.c.  paddr.c is
using not MADV_PAGEOUT but reclaim_pages().  Usage of reclaim_pages() from
paddr is different from that of MADV_PAGEOUT since paddr doesn't clear PTE.  I
was confused from the difference between vaddr and paddr.  I actually wanted to
document the difference but haven't had a time for that yet.  Thank you for
letting me remind this.

So, your change on MADV_PAGEOUT will make an effect to vaddr, and I think it's
ok.  Your change on reclaim_pages() could make an effect to paddr, depending on
the additional parameter's value.  I now think it would better to make no
effect here.  That is, let's keep the change for paddr.c in your patch as is.


Thanks,
SJ

> 
> >
> >
> > Thanks,
> > SJ
> >
> 
> Thanks
> Barry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ