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: <20250113194939.4152203-1-joshua.hahnjy@gmail.com>
Date: Mon, 13 Jan 2025 11:49:37 -0800
From: Joshua Hahn <joshua.hahnjy@...il.com>
To: SeongJae Park <sj@...nel.org>
Cc: kernel-team@...a.com,
	damon@...ts.linux.dev,
	linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 07/18] mm/damon/paddr: report filter-passed bytes back for DAMOS_STAT action

On Wed, 18 Dec 2024 20:03:16 -0800 SeongJae Park <sj@...nel.org> wrote:

Hello SJ,
I hope you are doing well! Sorry to add noise to an old mail, but I recently
saw Usama's patch that improves this function, and it brought my attention
to this series, so I have been reading it today.

I was unsure if I should send this mail because I had a nit / naive question
about the patch:

[...snip...]

> +static unsigned long damon_pa_stat(struct damon_region *r, struct damos *s,
> +		unsigned long *sz_filter_passed)
> +{
> +	unsigned long addr;
> +	LIST_HEAD(folio_list);
> +
> +	if (!damon_pa_scheme_has_filter(s))
> +		return 0;
> +
> +	for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) {
> +		struct folio *folio = damon_get_folio(PHYS_PFN(addr));
> +
> +		if (!folio)
> +			continue;
> +
> +		if (damos_pa_filter_out(s, folio))
> +			goto put_folio;
> +		else
> +			*sz_filter_passed += folio_size(folio);
> +put_folio:
> +		folio_put(folio);
> +	}
> +	return 0;

Is there a reason that we decide to use a goto statement here? As far as I
can tell, this is the only place this goto statement is used, and the else
case bleeds into it as well. That is, I believe that the following could be
more readable:

		if (!damos_pa_filter_out(s, folio))
			*sz_filter_passed += folio_size(folio);

		folio_put(folio);
	}
	return 0;

[...snip...]

Again, I am sorry if this is a naive question. Thank you for your time,
I hope you have a great day!
Joshua

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ