Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/damon/core: remove duplicate list_empty quota->goals check

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.

Link: https://lkml.kernel.org/r/20241125184307.41746-1-sj@kernel.org
Signed-off-by: Honggyu Kim <honggyu.kim@sk.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Honggyu Kim and committed by
Andrew Morton
66539952 9aec2fb0

+2 -5
+2 -5
mm/damon/core.c
··· 1550 1550 static void damos_set_effective_quota(struct damos_quota *quota) 1551 1551 { 1552 1552 unsigned long throughput; 1553 - unsigned long esz; 1553 + unsigned long esz = ULONG_MAX; 1554 1554 1555 1555 if (!quota->ms && list_empty(&quota->goals)) { 1556 1556 quota->esz = quota->sz; ··· 1572 1572 quota->total_charged_ns; 1573 1573 else 1574 1574 throughput = PAGE_SIZE * 1024; 1575 - if (!list_empty(&quota->goals)) 1576 - esz = min(throughput * quota->ms, esz); 1577 - else 1578 - esz = throughput * quota->ms; 1575 + esz = min(throughput * quota->ms, esz); 1579 1576 } 1580 1577 1581 1578 if (quota->sz && quota->sz < esz)