From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 8FE41C38A2A for ; Thu, 7 May 2020 22:01:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5E08320725 for ; Thu, 7 May 2020 22:01:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E08320725 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E92E4900003; Thu, 7 May 2020 18:00:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E442F900002; Thu, 7 May 2020 18:00:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5A1A900003; Thu, 7 May 2020 18:00:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0094.hostedemail.com [216.40.44.94]) by kanga.kvack.org (Postfix) with ESMTP id BD5DA900002 for ; Thu, 7 May 2020 18:00:59 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 754FC180AD801 for ; Thu, 7 May 2020 22:00:59 +0000 (UTC) X-FDA: 76791293838.10.pie31_7d03ea0112a34 X-HE-Tag: pie31_7d03ea0112a34 X-Filterd-Recvd-Size: 4034 Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Thu, 7 May 2020 22:00:58 +0000 (UTC) Received: from mail-qk1-f197.google.com ([209.85.222.197]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jWoYZ-0002Hl-DF for linux-mm@kvack.org; Thu, 07 May 2020 21:59:51 +0000 Received: by mail-qk1-f197.google.com with SMTP id g143so7324334qke.12 for ; Thu, 07 May 2020 14:59:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=D1x1mENpHEP5ot+awSAobGm/a7Ebe1DwB7eQXcB2jvE=; b=cPM/O97cqwLQPKc+dnOMCtf/9tpGAgDn8sGNkSuaOWNYeuCuz38Rt52zkQcObjQcUJ MtLO6cUv4Oy+MwnEwpnvREhGWYWxZODbcdpFVP3bxXM8Jcg2nqHRdGbOfhaWBk7h1bcD 1mJnL2kFRpYGXVCquu6W2tIdwDqqc9zMrKN4CIrMOE+ZWduh6DxiU2/3P9O9Stjgtfp6 yhSAYjLox5ZYtjBJhS6LGkSw2KFnlCZHUgZNPz6zICwi9m2bMf2cU2suqW/aQQ4mhGaR vBNPCioJUkwdQa8cPTKIfICAWfpaHbds4U+Zxd547cODhDc9NjlCp9BqVG9ibSdCmPqU Zl/A== X-Gm-Message-State: AGi0PuYZ+m42gwwJuX+RLokYhM9+TGH1USC1NIjRfRfH6g6rvOJliEG/ 3QqHXlIJa8r7eujrlUsMhL1lNvKiicQNA+7T2wY2jEiqfh61aidPzueZVHeKp3uCR1IOxovsKPu tAg/NBlSJ4d1c8cyJ+B2AuH+SZ6HW X-Received: by 2002:ac8:3406:: with SMTP id u6mr17008907qtb.100.1588888790307; Thu, 07 May 2020 14:59:50 -0700 (PDT) X-Google-Smtp-Source: APiQypKn7P+ZsPdBMfKkEheTB/2jdeakLAD1SUCaoK4gDmyBjSnrHINZlGPF+3PHlV/bvJU2bVvvZA== X-Received: by 2002:ac8:3406:: with SMTP id u6mr17008882qtb.100.1588888790043; Thu, 07 May 2020 14:59:50 -0700 (PDT) Received: from localhost ([187.56.73.116]) by smtp.gmail.com with ESMTPSA id 33sm5208928qtc.82.2020.05.07.14.59.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2020 14:59:49 -0700 (PDT) From: "Guilherme G. Piccoli" To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, gavin.guo@canonical.com, gpiccoli@canonical.com, kernel@gpiccoli.net Subject: [PATCH] mm, compaction: Indicate when compaction is manually triggered by sysctl Date: Thu, 7 May 2020 18:59:46 -0300 Message-Id: <20200507215946.22589-1-gpiccoli@canonical.com> X-Mailer: git-send-email 2.25.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000008, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Currently we have no way to determine if compaction was triggered by sysctl write, but this is an interesting information to have, specially in systems with high uptime that presents lots of fragmented memory. There's no statistic indicating if compaction was triggered manually or ran by Linux itself, the vmstat numbers cannot tell the user this information. This patch adds a very simple message to kernel log when compaction is requested through a write to sysctl file, and also it accumulates the number of previously manual compaction executions. It follows the approach used by drop_caches. Signed-off-by: Guilherme G. Piccoli --- This patch was based on linux-next/akpm branch, at d0f3f6070c3a. Thanks in advance for reviews! Cheers, Guilherme mm/compaction.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index fb43e731ac31..80e748b0bbb6 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2465,9 +2465,13 @@ int sysctl_compact_memory; int sysctl_compaction_handler(struct ctl_table *table, int write, void *buffer, size_t *length, loff_t *ppos) { - if (write) + static unsigned compaction_acct; + + if (write) { + pr_info("compact_memory triggered - it already previously ran %u times= \n", + compaction_acct++); compact_nodes(); - + } return 0; } =20 --=20 2.25.2