* [PATCH v2] mm/damon/core: remove duplicate list_empty quota->goals check
@ 2024-11-25 4:56 Honggyu Kim
2024-11-25 18:43 ` SeongJae Park
0 siblings, 1 reply; 2+ messages in thread
From: Honggyu Kim @ 2024-11-25 4:56 UTC (permalink / raw)
To: damon; +Cc: SeongJae Park, kernel_team, Honggyu Kim
The damos_set_effective_quota checks quota contidions but there are some
duplicate checks for quota->goals inside.
This patch reduces one of if statement to simplify the esz calculation
logic by setting esz as ULONG_MAX by default.
Signed-off-by: Honggyu Kim <honggyu.kim@sk.com>
---
mm/damon/core.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 511c3f61ab44..ecaf78270035 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -1542,7 +1542,7 @@ static unsigned long damos_quota_score(struct damos_quota *quota)
static void damos_set_effective_quota(struct damos_quota *quota)
{
unsigned long throughput;
- unsigned long esz;
+ unsigned long esz = ULONG_MAX;
if (!quota->ms && list_empty("a->goals)) {
quota->esz = quota->sz;
@@ -1564,10 +1564,7 @@ static void damos_set_effective_quota(struct damos_quota *quota)
quota->total_charged_ns;
else
throughput = PAGE_SIZE * 1024;
- if (!list_empty("a->goals))
- esz = min(throughput * quota->ms, esz);
- else
- esz = throughput * quota->ms;
+ esz = min(throughput * quota->ms, esz);
}
if (quota->sz && quota->sz < esz)
base-commit: adc218676eef25575469234709c2d87185ca223a
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] mm/damon/core: remove duplicate list_empty quota->goals check
2024-11-25 4:56 [PATCH v2] mm/damon/core: remove duplicate list_empty quota->goals check Honggyu Kim
@ 2024-11-25 18:43 ` SeongJae Park
0 siblings, 0 replies; 2+ messages in thread
From: SeongJae Park @ 2024-11-25 18:43 UTC (permalink / raw)
To: Honggyu Kim
Cc: SeongJae Park, damon, kernel_team, Andrew Morton, linux-mm,
linux-kernel
On Mon, 25 Nov 2024 13:56:55 +0900 Honggyu Kim <honggyu.kim@sk.com> wrote:
> The damos_set_effective_quota checks quota contidions but there are some
> duplicate checks for quota->goals inside.
>
> This patch reduces one of if statement to simplify the esz calculation
> logic by setting esz as ULONG_MAX by default.
>
> Signed-off-by: Honggyu Kim <honggyu.kim@sk.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
> ---
> mm/damon/core.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 511c3f61ab44..ecaf78270035 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -1542,7 +1542,7 @@ static unsigned long damos_quota_score(struct damos_quota *quota)
> static void damos_set_effective_quota(struct damos_quota *quota)
> {
> unsigned long throughput;
> - unsigned long esz;
> + unsigned long esz = ULONG_MAX;
>
> if (!quota->ms && list_empty("a->goals)) {
> quota->esz = quota->sz;
> @@ -1564,10 +1564,7 @@ static void damos_set_effective_quota(struct damos_quota *quota)
> quota->total_charged_ns;
> else
> throughput = PAGE_SIZE * 1024;
> - if (!list_empty("a->goals))
> - esz = min(throughput * quota->ms, esz);
> - else
> - esz = throughput * quota->ms;
> + esz = min(throughput * quota->ms, esz);
> }
>
> if (quota->sz && quota->sz < esz)
>
> base-commit: adc218676eef25575469234709c2d87185ca223a
> --
> 2.34.1
Thank you for addressing my comments on the v1
(https://lore.kernel.org/20241122081834.1344-1-honggyu.kim@sk.com), namely
- making commit message more specific, and
- using ULONG_MAX instead of UINT_MAX for esz default value.
Thanks,
SJ
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-25 18:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-25 4:56 [PATCH v2] mm/damon/core: remove duplicate list_empty quota->goals check Honggyu Kim
2024-11-25 18:43 ` SeongJae Park
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.