[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <ad2600f3d8d7c0d44b35d9fad0031d82c5a3c285.1622454385.git.charante@codeaurora.org>
Date: Mon, 31 May 2021 16:24:52 +0530
From: Charan Teja Reddy <charante@...eaurora.org>
To: akpm@...ux-foundation.org, vbabka@...e.cz, nigupta@...dia.com,
hannes@...xchg.org, corbet@....net, mcgrof@...nel.org,
keescook@...omium.org, yzaikin@...gle.com, aarcange@...hat.com,
cl@...ux.com, xi.fengfei@....com, mchehab+huawei@...nel.org,
andrew.a.klychkov@...il.com, dave.hansen@...ux.intel.com,
bhe@...hat.com, iamjoonsoo.kim@....com, mateusznosek0@...il.com,
sh_def@....com, vinmenon@...eaurora.org
Cc: linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
Charan Teja Reddy <charante@...eaurora.org>
Subject: [PATCH v3 2/2] mm: compaction: fix wakeup logic of proactive compaction
Currently, proactive compaction tries to get triggered for every
HPAGE_FRAG_CHECK_INTERVAL_MSEC(=500msec) even when proactive compaction
is disabled with sysctl.compaction_proactiveness = 0. This results in
kcompactd thread wakes up and goes to sleep for every 500msec with out
the need of doing proactive compaction. Though this doesn't have any
overhead, few cpu cycles can be saved by avoid of waking up kcompactd
thread for proactive compaction when it is disabled.
Signed-off-by: Charan Teja Reddy <charante@...eaurora.org>
---
- This patch is newly raised in V3, thus no changes exist in V1 and V2
mm/compaction.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/mm/compaction.c b/mm/compaction.c
index 197e203..0edcd0f 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -2926,11 +2926,14 @@ static int kcompactd(void *p)
while (!kthread_should_stop()) {
unsigned long pflags;
+ long timeout;
+ timeout = sysctl_compaction_proactiveness ?
+ msecs_to_jiffies(HPAGE_FRAG_CHECK_INTERVAL_MSEC) :
+ MAX_SCHEDULE_TIMEOUT;
trace_mm_compaction_kcompactd_sleep(pgdat->node_id);
if (wait_event_freezable_timeout(pgdat->kcompactd_wait,
- kcompactd_work_requested(pgdat),
- msecs_to_jiffies(HPAGE_FRAG_CHECK_INTERVAL_MSEC)) &&
+ kcompactd_work_requested(pgdat), timeout) &&
!pgdat->proactive_compact_trigger) {
psi_memstall_enter(&pflags);
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation
Powered by blists - more mailing lists