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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211021173018.15994-1-sj@kernel.org>
Date:   Thu, 21 Oct 2021 17:30:18 +0000
From:   SeongJae Park <sj@...nel.org>
To:     Xin Hao <xhao@...ux.alibaba.com>
Cc:     sjpark@...zon.de, akpm@...ux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2] mm/damon/dbgfs: Optimize target_ids interface write operation

Hello Xin,

On Fri, 22 Oct 2021 00:44:16 +0800 Xin Hao <xhao@...ux.alibaba.com> wrote:

> When we want to clear previously set target ids,
> For example, it works as below now:
>     # echo 42 > target_ids
>     # cat target_ids
>     42
>     # echo > target_ids
>     # cat target_ids
> 
> But in 'dbgfs_target_ids_write', there is no need to
> execute other codes, except call 'damon_set_targets'
> to clear previously set target ids. So there adds
> the 'nr_targets' judgment, if the value is 0, just
> call 'damon_set_targets', and then return.

It's true that it executes some unnecessary code.  However, I unsure if that is
a problem, as the code that will be additionally executed in this case are
quite simple ones, and therefore not supposed to incur viewable overhead.
After all, this is not a performance critical path.

Thanks,
SJ

> 
> Signed-off-by: Xin Hao <xhao@...ux.alibaba.com>
> ---
>  mm/damon/dbgfs.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c
> index a02cf6bee8e8..1d83f4138fad 100644
> --- a/mm/damon/dbgfs.c
> +++ b/mm/damon/dbgfs.c
> @@ -362,6 +362,12 @@ static ssize_t dbgfs_target_ids_write(struct file *file,
>  		goto out;
>  	}
> 
> +	if (!nr_targets) {
> +		/* remove targets with previously-set primitive */
> +		damon_set_targets(ctx, NULL, 0);
> +		goto free_targets_out;
> +	}
> +
>  	if (id_is_pid) {
>  		for (i = 0; i < nr_targets; i++) {
>  			targets[i] = (unsigned long)find_get_pid(
> --
> 2.31.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ