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] [day] [month] [year] [list]
Message-ID: <20200814092951.13988-1-sjpark@amazon.com>
Date:   Fri, 14 Aug 2020 11:29:51 +0200
From:   SeongJae Park <sjpark@...zon.com>
To:     SeongJae Park <sjpark@...zon.com>
CC:     <akpm@...ux-foundation.org>, <Jonathan.Cameron@...wei.com>,
        <aarcange@...hat.com>, <acme@...nel.org>,
        <alexander.shishkin@...ux.intel.com>, <amit@...nel.org>,
        <benh@...nel.crashing.org>, <brendan.d.gregg@...il.com>,
        <brendanhiggins@...gle.com>, <cai@....pw>,
        <colin.king@...onical.com>, <corbet@....net>, <david@...hat.com>,
        <dwmw@...zon.com>, <fan.du@...el.com>, <foersleo@...zon.de>,
        <gthelen@...gle.com>, <irogers@...gle.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>,
        <riel@...riel.com>, <rientjes@...gle.com>, <rostedt@...dmis.org>,
        <rppt@...nel.org>, <sblbir@...zon.com>, <shakeelb@...gle.com>,
        <shuah@...nel.org>, <sj38.park@...il.com>, <snu@...zon.de>,
        <vbabka@...e.cz>, <vdavydov.dev@...il.com>,
        <yang.shi@...ux.alibaba.com>, <ying.huang@...el.com>,
        <linux-damon@...zon.com>, <linux-mm@...ck.org>,
        <linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v19 02/15] mm/damon: Implement region based sampling

On Tue, 4 Aug 2020 11:14:03 +0200 SeongJae Park <sjpark@...zon.com> wrote:

> From: SeongJae Park <sjpark@...zon.de>
> 
> DAMON separates its monitoring target address space independent high
> level logics from the target space dependent low level primitives for
> flexible support of various address spaces.
> 
> This commit implements DAMON's target address space independent high
> level logics for basic access check and region based sampling.  Hence,
> without the target address space specific parts implementations, this
> doesn't work alone.  A reference implementation of those will be
> provided by a later commit.
[...]
> Signed-off-by: SeongJae Park <sjpark@...zon.de>
> Reviewed-by: Leonard Foerster <foersleo@...zon.de>
> ---
>  include/linux/damon.h |  89 ++++++++++++++-
>  mm/damon.c            | 256 +++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 342 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/damon.h b/include/linux/damon.h
> index a6e839a236f4..0b1153971e6d 100644
> --- a/include/linux/damon.h
> +++ b/include/linux/damon.h
> @@ -11,6 +11,8 @@
>  #define _DAMON_H_
>  
>  #include <linux/random.h>
> +#include <linux/mutex.h>
> +#include <linux/time64.h>
>  #include <linux/types.h>
>  
>  /**
> @@ -56,11 +58,96 @@ struct damon_target {
>  };
>  
>  /**
> - * struct damon_ctx - Represents a context for each monitoring.
> + * struct damon_ctx - Represents a context for each monitoring.  This is the
> + * main interface that allows users to set the attributes and get the results
> + * of the monitoring.
> + *
> + * @sample_interval:		The time between access samplings.
> + * @aggr_interval:		The time between monitor results aggregations.
> + * @nr_regions:			The number of monitoring regions.
> + *
> + * For each @sample_interval, DAMON checks whether each region is accessed or
> + * not.  It aggregates and keeps the access information (number of accesses to
> + * each region) for @aggr_interval time.  All time intervals are in
> + * micro-seconds.
> + *
> + * @kdamond:		Kernel thread who does the monitoring.
> + * @kdamond_stop:	Notifies whether kdamond should stop.
> + * @kdamond_lock:	Mutex for the synchronizations with @kdamond.
> + *
> + * For each monitoring request (damon_start()), a kernel thread for the
> + * monitoring is created.  The pointer to the thread is stored in @kdamond.

This means that multiple monitoring threads can concurrently run.  This is an
intended design to let users utilize multiple CPUs.  For example, let's suppose
the user need super high accuracy of the monitoring results which require
multiple CPU power.  If use of the multiple CPUs are allowed, the user can
split the monitoring target regions into multiple contexts and call
'damon_start()' for each of the context.

If multiple monitoring threads has conflicting target regions, they will
interfere each other.  Currently, avoidance of such conflict should be done by
'damon_start()' users.  The synchronization would be complicated.

To make the situation simple, I will make the 'damon_start()' receive a group
of 'damon_ctx' objects and creates a group of monitoring threads for the
objects at once.  This will only reduce number of 'damon_start()' calls
required to run multiple monitoring threads.  In addition to this, the groups
of monitoring threads will be mutual exclusive.  In other words,
'damon_start()' will fail if a group of monitoring threads that started by
other 'damon_start()' call is currently running.

This still ask the users to protect each monitoring threads by taking care in
their requests.  But, because the requests are made by the user on its own,
avoiding the conflict will be quite easy.  Further, intentional conflict is
also possible, though I'm unsure how the intentional conflict can be required.

The change will be made in the next spin.


Thanks,
SeongJae Park

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ