Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2502416pxj; Mon, 31 May 2021 03:58:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyr5WmAEJyhqnf4AsUYc53abYtNDD65Lab8R9Kp4ej7Rsge5Cc/6JhIvI11pKafxi1PTZL2 X-Received: by 2002:a6b:7112:: with SMTP id q18mr7048998iog.128.1622458731132; Mon, 31 May 2021 03:58:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622458731; cv=none; d=google.com; s=arc-20160816; b=dlYrbbq5PRFDIHLU+nwbUggGxbxYCrMTsLT9GZSWtExSkbfIW6SJILRMayrFK9wNFK +JxKyDaPt073sSiM9408bnfVhj042qkqQsuNZjBF4SbzCZYnEWxeEj5U8LVcDmpOiHlP sST2LRzP1rzVcE1+Uk95IV9l796F01C3nAq6iqNfuh1rdeYaZ47ahLFwbqFHWfQbezPm UPpt0z/rE0iDqM2kcMMs54hP+TSZUVHhbqvJHXrSfTVzKT0rkCJX1IIenfmADDPx21In C+euuA8TvFaqIYaX6FKst7ED/mDDJ/i5WYFQbhcv7aksfPDk55XVGPd5T/nCcp8cWzdN tFFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:cc:to:from:dmarc-filter:sender :dkim-signature; bh=QlYc3u3TuNAPivVce1iIXZSsOE1D8aMMOWtQav1jEe4=; b=mmR0LRbLWM9Ur8rOvWe+mYxxWg2LAw4iBATU9hQywK/3bnV2wOSwPl66VEiQCRt7Z7 i5NohJ0HL34PSW+b/EERp7rDCYX2jBubmhD1lhngAhXs6ddUQBZvYACainG/RBlOqzqG mXYqQtLuJZ4+h16cKS2kJyXHUTjl7cdlefhas0Eq/4Yii43W41ba3QUdXgUFDzQfopwF 830eylCWX1KFc94XN9VPtLH1pW6RgXoHzRqvXfmqVlbCGmPxGwVdzV26FuexNgliHBsf 7c5pMlxDQpsR0RyLVeciEdlHzGHJzsBQZMrnug9rsrLPKV84dQTlHVMk1EGdREgvZ7u+ k1wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=c836FfeY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i13si15867573ilm.156.2021.05.31.03.58.38; Mon, 31 May 2021 03:58:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=c836FfeY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231389AbhEaK6U (ORCPT + 99 others); Mon, 31 May 2021 06:58:20 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:34309 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231357AbhEaK56 (ORCPT ); Mon, 31 May 2021 06:57:58 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1622458578; h=References: In-Reply-To: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=QlYc3u3TuNAPivVce1iIXZSsOE1D8aMMOWtQav1jEe4=; b=c836FfeY1vXG0yR7XvLEA/11ez9oWjjAA/TGoqG1BJ2TbENzOUKt0QCzTts3ThIDs79/VeCc +SWpBruCwHovXoH1MPLonWNAHhrnVETT7Prs73+00VG8kk/miMPc/QwBQ1/sv/l2T3ayEDEk AWvMANiHRPz7BatYkE7SLrQzTGc= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n05.prod.us-east-1.postgun.com with SMTP id 60b4c0d2f726fa41881b499e (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 31 May 2021 10:56:18 GMT Sender: charante=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id EFC0AC43147; Mon, 31 May 2021 10:56:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 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 75601C4338A; Mon, 31 May 2021 10:56:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 75601C4338A Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=charante@codeaurora.org From: Charan Teja Reddy To: akpm@linux-foundation.org, vbabka@suse.cz, nigupta@nvidia.com, hannes@cmpxchg.org, corbet@lwn.net, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, aarcange@redhat.com, cl@linux.com, xi.fengfei@h3c.com, mchehab+huawei@kernel.org, andrew.a.klychkov@gmail.com, dave.hansen@linux.intel.com, bhe@redhat.com, iamjoonsoo.kim@lge.com, mateusznosek0@gmail.com, sh_def@163.com, vinmenon@codeaurora.org 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 v3 2/2] mm: compaction: fix wakeup logic of proactive compaction Date: Mon, 31 May 2021 16:24:52 +0530 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- - 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