From: SeongJae Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: SeongJae Park <sj@kernel.org>,
damon@lists.linux.dev, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] Revert "mm/damon/lru_sort: adjust local variable to dynamic allocation"
Date: Sun, 25 Aug 2024 21:23:23 -0700 [thread overview]
Message-ID: <20240826042323.87025-5-sj@kernel.org> (raw)
In-Reply-To: <20240826042323.87025-1-sj@kernel.org>
This reverts commit 0742cadf5e4c080aa9bab323dfb234c37a86e884.
The commit was introduced to avoid unnecessary usage of stack memory for
per-scheme region priorities histogram buffer. The fix is nice, but the
point of the fix looks not very clear if the commit message is not read
together. That's mainly because the buffer is a private field, which
means it is hidden from the DAMON API users. That's not the fault of
the fix but the underlying data structure.
Now the per-scheme histogram buffer is gone, so the problem that the
commit was fixing is also removed. The use of kmemdup() has no more
point but just making the code bit difficult to understand. Revert the
fix.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/lru_sort.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c
index 0b35bd5fb659..4af8fd4a390b 100644
--- a/mm/damon/lru_sort.c
+++ b/mm/damon/lru_sort.c
@@ -148,17 +148,12 @@ static struct damon_target *target;
static struct damos *damon_lru_sort_new_scheme(
struct damos_access_pattern *pattern, enum damos_action action)
{
- struct damos *damos;
- struct damos_quota *quota = kmemdup(&damon_lru_sort_quota,
- sizeof(damon_lru_sort_quota), GFP_KERNEL);
-
- if (!quota)
- return NULL;
+ struct damos_quota quota = damon_lru_sort_quota;
/* Use half of total quota for hot/cold pages sorting */
- quota->ms = quota->ms / 2;
+ quota.ms = quota.ms / 2;
- damos = damon_new_scheme(
+ return damon_new_scheme(
/* find the pattern, and */
pattern,
/* (de)prioritize on LRU-lists */
@@ -166,12 +161,10 @@ static struct damos *damon_lru_sort_new_scheme(
/* for each aggregation interval */
0,
/* under the quota. */
- quota,
+ "a,
/* (De)activate this according to the watermarks. */
&damon_lru_sort_wmarks,
NUMA_NO_NODE);
- kfree(quota);
- return damos;
}
/* Create a DAMON-based operation scheme for hot memory regions */
--
2.39.2
prev parent reply other threads:[~2024-08-26 4:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-26 4:23 [PATCH 0/4] replace per-quota region priorities histogram buffer with per-context one SeongJae Park
2024-08-26 4:23 ` [PATCH 1/4] mm/damon/core: intorduce per-context region priorities histogram buffer SeongJae Park
2024-08-26 4:23 ` [PATCH 2/4] mm/damon/core: replace per-quota regions priority histogram buffer usage with per-context one SeongJae Park
2024-08-26 4:23 ` [PATCH 3/4] mm/damon/core: remove per-scheme region priority histogram buffer SeongJae Park
2024-08-26 4:23 ` SeongJae Park [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240826042323.87025-5-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).