From patchwork Tue Oct 19 15:07:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12570293 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20410C433F5 for ; Tue, 19 Oct 2021 15:08:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B06336103D for ; Tue, 19 Oct 2021 15:08:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B06336103D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id C87C86B0082; Tue, 19 Oct 2021 11:08:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C62736B0083; Tue, 19 Oct 2021 11:08:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B76496B0085; Tue, 19 Oct 2021 11:08:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0086.hostedemail.com [216.40.44.86]) by kanga.kvack.org (Postfix) with ESMTP id A44096B0082 for ; Tue, 19 Oct 2021 11:08:06 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6AB342B371 for ; Tue, 19 Oct 2021 15:08:06 +0000 (UTC) X-FDA: 78713517372.21.F494449 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf14.hostedemail.com (Postfix) with ESMTP id 2B1626001986 for ; Tue, 19 Oct 2021 15:08:07 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id F21A860F22; Tue, 19 Oct 2021 15:08:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634656085; bh=BUbtItIfGpDhgNPVfTufa4K3O0hNi69LHwsG38Q6v04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KaY83aVaq0NJhJnK4EynzmbtFkeMG5QwqzaJ1tx7kc3gOOZoNtKn7m9dkiMdN2mz8 mIBKo1xZwVVCCFQXsHokIjVJDG8pneLZNyS2maG+8ACLzX4Xid947GhciJKeQzw2fO E1elwY5OD7w8MHh0JXOt9XRySpyW+x0Dr9bJqjK3cbcfO5FcyIshvgE6Dj24v8kn5b jr9Oz7xDvzdjxK0dVcAP0erpoGYp5RvP8XN18TPXA0aNuJ7mnLXbYC1d1OFYiJWbZa p5JWtk/3osHWgw7b+RhAVSWMthBbrlE7u/t3MWCEXFqlk+JzcksO4pXUymqqYXYRuR UfztV5XC5rZjQ== From: SeongJae Park To: akpm@linux-foundation.org Cc: SeongJae Park , Jonathan.Cameron@Huawei.com, amit@kernel.org, benh@kernel.crashing.org, corbet@lwn.net, david@redhat.com, dwmw@amazon.com, elver@google.com, foersleo@amazon.de, gthelen@google.com, markubo@amazon.de, rientjes@google.com, shakeelb@google.com, shuah@kernel.org, linux-damon@amazon.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/15] mm/damon/dbgfs: Support prioritization weights Date: Tue, 19 Oct 2021 15:07:25 +0000 Message-Id: <20211019150731.16699-10-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211019150731.16699-1-sj@kernel.org> References: <20211019150731.16699-1-sj@kernel.org> Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=KaY83aVa; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of sj@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=sj@kernel.org X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 2B1626001986 X-Stat-Signature: ntruuprdgz1iy8dct3qa9r4ad5beccxa X-HE-Tag: 1634656087-554456 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: This commit allows DAMON debugfs interface users set the prioritization weights by putting three more numbers to the 'schemes' file. Signed-off-by: SeongJae Park --- mm/damon/dbgfs.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c index 097e6745ba75..20c4feb8b918 100644 --- a/mm/damon/dbgfs.c +++ b/mm/damon/dbgfs.c @@ -105,13 +105,16 @@ static ssize_t sprint_schemes(struct damon_ctx *c, char *buf, ssize_t len) damon_for_each_scheme(s, c) { rc = scnprintf(&buf[written], len - written, - "%lu %lu %u %u %u %u %d %lu %lu %lu %lu %lu\n", + "%lu %lu %u %u %u %u %d %lu %lu %lu %u %u %u %lu %lu\n", s->min_sz_region, s->max_sz_region, s->min_nr_accesses, s->max_nr_accesses, s->min_age_region, s->max_age_region, s->action, s->quota.ms, s->quota.sz, s->quota.reset_interval, + s->quota.weight_sz, + s->quota.weight_nr_accesses, + s->quota.weight_age, s->stat_count, s->stat_sz); if (!rc) return -ENOMEM; @@ -193,11 +196,14 @@ static struct damos **str_to_schemes(const char *str, ssize_t len, while (pos < len && *nr_schemes < max_nr_schemes) { struct damos_quota quota = {}; - ret = sscanf(&str[pos], "%lu %lu %u %u %u %u %u %lu %lu %lu%n", + ret = sscanf(&str[pos], + "%lu %lu %u %u %u %u %u %lu %lu %lu %u %u %u%n", &min_sz, &max_sz, &min_nr_a, &max_nr_a, &min_age, &max_age, &action, "a.ms, - "a.sz, "a.reset_interval, &parsed); - if (ret != 10) + "a.sz, "a.reset_interval, + "a.weight_sz, "a.weight_nr_accesses, + "a.weight_age, &parsed); + if (ret != 13) break; if (!damos_action_valid(action)) { pr_err("wrong action %d\n", action);