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]
Date:	Thu, 16 Jul 2015 12:53:56 +0300
From:	Vladimir Davydov <vdavydov@...allels.com>
To:	Andres Lagar-Cavilla <andreslc@...gle.com>
CC:	Andrew Morton <akpm@...ux-foundation.org>,
	Minchan Kim <minchan@...nel.org>,
	Raghavendra K T <raghavendra.kt@...ux.vnet.ibm.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Michal Hocko <mhocko@...e.cz>,
	Greg Thelen <gthelen@...gle.com>,
	Michel Lespinasse <walken@...gle.com>,
	David Rientjes <rientjes@...gle.com>,
	Pavel Emelyanov <xemul@...allels.com>,
	Cyrill Gorcunov <gorcunov@...nvz.org>,
	Jonathan Corbet <corbet@....net>, <linux-api@...r.kernel.org>,
	<linux-doc@...r.kernel.org>, <linux-mm@...ck.org>,
	<cgroups@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -mm v8 6/7] proc: add kpageidle file

On Wed, Jul 15, 2015 at 12:42:28PM -0700, Andres Lagar-Cavilla wrote:
> On Wed, Jul 15, 2015 at 6:54 AM, Vladimir Davydov
> <vdavydov@...allels.com> wrote:
[...]
> > +static void kpageidle_clear_pte_refs(struct page *page)
> > +{
> > +       struct rmap_walk_control rwc = {
> > +               .rmap_one = kpageidle_clear_pte_refs_one,
> > +               .anon_lock = page_lock_anon_vma_read,
> > +       };
> > +       bool need_lock;
> > +
> > +       if (!page_mapped(page) ||
> 
> Question: what about mlocked pages? Is there any point in calculating
> their idleness?

Those can be filtered out with the aid of /proc/kpageflags (this is what
the script attached to patch #0 of the series actually does). We have to
read the latter anyway in order to get information about THP. That said,
I prefer not to introduce any artificial checks for locked memory. Who
knows, may be one day somebody will use this API to track access pattern
to an mlocked area.

> 
> > +           !page_rmapping(page))
> 
> Not sure, does this skip SwapCache pages? Is there any point in
> calculating their idleness?

A SwapCache page may be mapped, and if it is we should not skip it. If
it is unmapped, we have nothing to do.

Regarding idleness of SwapCache pages, I think we shouldn't
differentiate them from other user pages here, because a shmem/anon page
can migrate to-and-fro the swap cache occasionally during a
memory-active workload, and we don't want to lose its idle status then.

> 
> > +               return;
> > +
> > +       need_lock = !PageAnon(page) || PageKsm(page);
> > +       if (need_lock && !trylock_page(page))
> > +               return;
> > +
> > +       rmap_walk(page, &rwc);
> > +
> > +       if (need_lock)
> > +               unlock_page(page);
> > +}
[...]
> > @@ -1754,6 +1754,11 @@ static void __split_huge_page_refcount(struct page *page,
> >                 /* clear PageTail before overwriting first_page */
> >                 smp_wmb();
> >
> > +               if (page_is_young(page))
> > +                       set_page_young(page_tail);
> > +               if (page_is_idle(page))
> > +                       set_page_idle(page_tail);
> > +
> 
> Why not in the block above?
> 
> page_tail->flags |= (page->flags &
> ...
> #ifdef CONFIG_WHATEVER_IT_WAS
> 1 << PG_idle
> 1 << PG_young
> #endif

Too many ifdef's :-/ Note, the flags can be in page_ext, which mean we
would have to add something like this

#if defined(CONFIG_WHATEVER_IT_WAS) && defined(CONFIG_64BIT)
1 << PG_idle
1 << PG_young
#endif
<...>
#ifndef CONFIG_64BIT
if (page_is_young(page))
	set_page_young(page_tail);
if (page_is_idle(page))
	set_page_idle(page_tail);
#endif

which IMO looks less readable than what we have now.

Thanks,
Vladimir
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ