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:   Tue, 10 Mar 2020 12:53:24 +0100
From:   SeongJae Park <sjpark@...zon.com>
To:     Jonathan Cameron <Jonathan.Cameron@...wei.com>
CC:     SeongJae Park <sjpark@...zon.com>, <akpm@...ux-foundation.org>,
        "SeongJae Park" <sjpark@...zon.de>, <aarcange@...hat.com>,
        <yang.shi@...ux.alibaba.com>, <acme@...nel.org>,
        <alexander.shishkin@...ux.intel.com>, <amit@...nel.org>,
        <brendan.d.gregg@...il.com>, <brendanhiggins@...gle.com>,
        <cai@....pw>, <colin.king@...onical.com>, <corbet@....net>,
        <dwmw@...zon.com>, <jolsa@...hat.com>, <kirill@...temov.name>,
        <mark.rutland@....com>, <mgorman@...e.de>, <minchan@...nel.org>,
        <mingo@...hat.com>, <namhyung@...nel.org>, <peterz@...radead.org>,
        <rdunlap@...radead.org>, <rientjes@...gle.com>,
        <rostedt@...dmis.org>, <shuah@...nel.org>, <sj38.park@...il.com>,
        <vbabka@...e.cz>, <vdavydov.dev@...il.com>, <linux-mm@...ck.org>,
        <linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: Re: [PATCH v6 03/14] mm/damon: Adaptively adjust regions

On Tue, 10 Mar 2020 08:57:47 +0000 Jonathan Cameron <Jonathan.Cameron@...wei.com> wrote:

> On Mon, 24 Feb 2020 13:30:36 +0100
> SeongJae Park <sjpark@...zon.com> wrote:
> 
> > From: SeongJae Park <sjpark@...zon.de>
> > 
> > At the beginning of the monitoring, DAMON constructs the initial regions
> > by evenly splitting the memory mapped address space of the process into
> > the user-specified minimal number of regions.  In this initial state,
> > the assumption of the regions (pages in same region have similar access
> > frequencies) is normally not kept and thus the monitoring quality could
> > be low.  To keep the assumption as much as possible, DAMON adaptively
> > merges and splits each region.
> > 
> > For each ``aggregation interval``, it compares the access frequencies of
> > adjacent regions and merges those if the frequency difference is small.
> > Then, after it reports and clears the aggregated access frequency of
> > each region, it splits each region into two regions if the total number
> > of regions is smaller than the half of the user-specified maximum number
> > of regions.
> > 
> > In this way, DAMON provides its best-effort quality and minimal overhead
> > while keeping the bounds users set for their trade-off.
> > 
> > Signed-off-by: SeongJae Park <sjpark@...zon.de>
> 
> Really minor comments inline.

Very helpful comments for me.  You are indeed making this much better!  Will
apply whole your comments below in the next spin.

> 
> > ---
> >  mm/damon.c | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++---
> >  1 file changed, 144 insertions(+), 7 deletions(-)
> > 
> > diff --git a/mm/damon.c b/mm/damon.c
> > index 6bdeb84d89af..1c8bb71bbce9 100644
> > --- a/mm/damon.c
> > +++ b/mm/damon.c
[...]
> > +/*
> > + * Merge adjacent regions having similar access frequencies
> > + *
> > + * t		task that merge operation will make change
> > + * thres	merge regions having '->nr_accesses' diff smaller than this
> > + */
> > +static void damon_merge_regions_of(struct damon_task *t, unsigned int thres)
> > +{
> > +	struct damon_region *r, *prev = NULL, *next;
> > +
> > +	damon_for_each_region_safe(r, next, t) {
> > +		if (!prev || prev->vm_end != r->vm_start)
> > +			goto next;
> > +		if (diff_of(prev->nr_accesses, r->nr_accesses) > thres) 
> > +			goto next;
> 
> 		if (!prev || prev->vm_end != r->vm_start ||
> 		    diff_of(prev->nr_accesses, r->nr_accesses) > thres) {
> 			prev = r;
> 			continue;
> 		}
> 
> Seems more logical to my head.  Maybe it's just me though.  A goto inside a
> loop isn't pretty to my mind.

Yes, your version seems much prettier to me, either :)

> 
> > +		damon_merge_two_regions(prev, r);
> > +		continue;
> > +next:
> > +		prev = r;
> > +	}
> > +}
> > +
[...]
> > @@ -590,21 +711,29 @@ static int kdamond_fn(void *data)
> >  	struct damon_task *t;
> >  	struct damon_region *r, *next;
> >  	struct mm_struct *mm;
> > +	unsigned long max_nr_accesses;
> >  
> >  	pr_info("kdamond (%d) starts\n", ctx->kdamond->pid);
> >  	kdamond_init_regions(ctx);
> >  	while (!kdamond_need_stop(ctx)) {
> > +		max_nr_accesses = 0;
> >  		damon_for_each_task(ctx, t) {
> >  			mm = damon_get_mm(t);
> >  			if (!mm)
> >  				continue;
> > -			damon_for_each_region(r, t)
> > +			damon_for_each_region(r, t) {
> >  				kdamond_check_access(ctx, mm, r);
> > +				if (r->nr_accesses > max_nr_accesses)
> > +					max_nr_accesses = r->nr_accesses;
> 
> max_nr_accesses = max(r->nr_accesses, max_nr_accesses)

Good point!


Thanks,
SeongJae Park

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ