From patchwork Fri Jun 18 15:18:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charan Teja Kalla X-Patchwork-Id: 12331645 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07794C48BE8 for ; Fri, 18 Jun 2021 15:19:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A0601613EC for ; Fri, 18 Jun 2021 15:19:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0601613EC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 44FD56B0080; Fri, 18 Jun 2021 11:19:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 400B56B0081; Fri, 18 Jun 2021 11:19:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A1256B0082; Fri, 18 Jun 2021 11:19:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0103.hostedemail.com [216.40.44.103]) by kanga.kvack.org (Postfix) with ESMTP id EC4776B0080 for ; Fri, 18 Jun 2021 11:19:56 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 97C04EFCF for ; Fri, 18 Jun 2021 15:19:56 +0000 (UTC) X-FDA: 78267204792.15.5DDC53D Received: from m43-7.mailgun.net (m43-7.mailgun.net [69.72.43.7]) by imf10.hostedemail.com (Postfix) with ESMTP id 693BC4211084 for ; Fri, 18 Jun 2021 15:19:55 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1624029596; h=References: In-Reply-To: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=ND/72u+nNISmAsgxRuyz5vLjkrP/NEQ6vHD7wkgEiKc=; b=BfGAL1xtfdO9TDWCsnHk1dNI4G0HKkRWd59LXsd66eX4PGm4nN77QAIF8Z6mml/jRAXSEt+B hElhW2CNQpXPODXPvPyo/EPnoYS0vFhh85gLWU8IG5QjngGA5CefRN2nyFjFhVdU23uijTqG d7cylrywDm5Q3s53z5NeTnJUgPQ= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyIwY2Q3OCIsICJsaW51eC1tbUBrdmFjay5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n03.prod.us-west-2.postgun.com with SMTP id 60ccb99aed59bf69cca34a57 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 18 Jun 2021 15:19:54 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 1685CC43146; Fri, 18 Jun 2021 15:19:53 +0000 (UTC) Received: from hu-charante-hyd.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: charante) by smtp.codeaurora.org (Postfix) with ESMTPSA id 39F64C43460; Fri, 18 Jun 2021 15:19:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 39F64C43460 From: Charan Teja Reddy To: akpm@linux-foundation.org, vbabka@suse.cz, corbet@lwn.net, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, osalvador@suse.de, rientjes@google.com, mchehab+huawei@kernel.org, lokeshgidra@google.com, andrew.a.klychkov@gmail.com, xi.fengfei@h3c.com, nigupta@nvidia.com, dave.hansen@linux.intel.com, famzheng@amazon.com, mateusznosek0@gmail.com, oleksandr@redhat.com, sh_def@163.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Charan Teja Reddy Subject: [PATCH V4 3/3] mm: compaction: fix wakeup logic of proactive compaction Date: Fri, 18 Jun 2021 20:48:55 +0530 Message-Id: <89e90b9c13566e7c28d70e5d6aa048ee3ec41757.1624028025.git.charante@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=mg.codeaurora.org header.s=smtp header.b=BfGAL1xt; spf=pass (imf10.hostedemail.com: domain of bounce@mg.codeaurora.org designates 69.72.43.7 as permitted sender) smtp.mailfrom=bounce@mg.codeaurora.org; dmarc=none X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 693BC4211084 X-Stat-Signature: 6tf4nmdciy8qyzpfsxjygomjayihw9yq X-HE-Tag: 1624029595-717037 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 --- -- Changes in V4: o No functional changes from V3. -- Changes in V3: o Fix wake up logic in proactive compaction. -- Changes in V2 through V2 doesn't exist. mm/compaction.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index 7672be3..44a232a 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2928,6 +2928,8 @@ static int kcompactd(void *p) while (!kthread_should_stop()) { unsigned long pflags; + if (!sysctl_compaction_proactiveness) + timeout = MAX_SCHEDULE_TIMEOUT; trace_mm_compaction_kcompactd_sleep(pgdat->node_id); if (wait_event_freezable_timeout(pgdat->kcompactd_wait, kcompactd_work_requested(pgdat), timeout) &&