From patchwork Tue Jul 20 13:13:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12388285 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,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 E7326C636C8 for ; Tue, 20 Jul 2021 13:14:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9202160551 for ; Tue, 20 Jul 2021 13:14:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9202160551 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4E3996B0078; Tue, 20 Jul 2021 09:14:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4BA936B007B; Tue, 20 Jul 2021 09:14:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 335046B007D; Tue, 20 Jul 2021 09:14:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0173.hostedemail.com [216.40.44.173]) by kanga.kvack.org (Postfix) with ESMTP id 0CFB46B0078 for ; Tue, 20 Jul 2021 09:14:30 -0400 (EDT) Received: from smtpin33.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 851498248047 for ; Tue, 20 Jul 2021 13:14:28 +0000 (UTC) X-FDA: 78383010216.33.E413285 Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) by imf16.hostedemail.com (Postfix) with ESMTP id 302E4F00009D for ; Tue, 20 Jul 2021 13:14:28 +0000 (UTC) Received: by mail-qv1-f42.google.com with SMTP id ck17so10039439qvb.9 for ; Tue, 20 Jul 2021 06:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QWr2BUkC4vvi9PM11ezntCMBhcCSyWA7DgM4Q5kuaLU=; b=Utq+RpuMRXgMXcdrvC6umPzmRtG3+auvypucw0Mh9V5KsDQKasPqaKQZhixrOKk1hJ ZS7kXhz6SXpwJGP18CvVNsIsbd9UGqtsOS0mvqwodSY1bz5CNud6AvNz7A/R/kms7qD6 P+YiMKGadHslMcq4Z5RMuKRtVL61+M7kvkKGoaODW5vCwZnEdVA2ecB6LZClGKv/oW4a ainJ7pgrwoSLp0trcw4w6KNiElr6L7G3EKqfU+wvgM/LIIezdbkKzQQCS+sVAlx6eeeT yMb5d5oLL4Cui6iwx8cAAT4x8psgvyGQdSlQMxgx+21ctylM0GXxmNjZWfdX8oIZ0fX6 achA== 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:in-reply-to :references; bh=QWr2BUkC4vvi9PM11ezntCMBhcCSyWA7DgM4Q5kuaLU=; b=Joj4JZKfyZcM8jIqbC1FkavqMGJNmeNReXo9o9sZMhLpJpflGXg8c7g8ge8D1nKHo1 1MfEVWC0JjFpLoZmwo7/eto/T6SyVpftmnBqIeIThUSZ0uTQnHEdnbgzbjBJclbgZg0U X+6MGhZ6P2dVEc7nf6iwDz94fqfa0J29Fhj0MH4EOHbltj7V/cR6S0BwXZcMaEWUeDPI iV5ocyH2gUQJB9oVeodRnznm58tqAmL4PVAiz4STi4ah+DWqxQAKZ3A79vvGIgFPmQae N117Xpiy8Ai2+jWDXW7X+ik47v/NCDZ6afSZnlQEJoYfs7yqNnbs5EHJDDH4EyzvkTGp kRog== X-Gm-Message-State: AOAM532pGKKXTgIU4vjXh8aFhueKKiJwu4jdEeE4nvsE+mGZ5yTNHdrj w4dabFFza+Ynx4wtEOU1jJ4= X-Google-Smtp-Source: ABdhPJzU/oZsWMgvR36q8SniWa6pLaFlm6s2cnx4Cx9k+RudbNGPvCx5QEqWVowKYTRc2Qo3plfjng== X-Received: by 2002:a0c:fa08:: with SMTP id q8mr25163182qvn.8.1626786867608; Tue, 20 Jul 2021 06:14:27 -0700 (PDT) Received: from localhost.localdomain (ec2-35-169-212-159.compute-1.amazonaws.com. [35.169.212.159]) by smtp.gmail.com with ESMTPSA id g17sm9701225qkm.34.2021.07.20.06.14.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:14:27 -0700 (PDT) From: SeongJae Park To: akpm@linux-foundation.org Cc: SeongJae Park , Jonathan.Cameron@Huawei.com, acme@kernel.org, alexander.shishkin@linux.intel.com, amit@kernel.org, benh@kernel.crashing.org, brendanhiggins@google.com, corbet@lwn.net, david@redhat.com, dwmw@amazon.com, elver@google.com, fan.du@intel.com, foersleo@amazon.de, greg@kroah.com, gthelen@google.com, guoju.fgj@alibaba-inc.com, jgowans@amazon.com, joe@perches.com, mgorman@suse.de, mheyne@amazon.de, minchan@kernel.org, mingo@redhat.com, namhyung@kernel.org, peterz@infradead.org, riel@surriel.com, rientjes@google.com, rostedt@goodmis.org, rppt@kernel.org, shakeelb@google.com, shuah@kernel.org, sieberf@amazon.com, sj38.park@gmail.com, snu@zelle79.org, vbabka@suse.cz, vdavydov.dev@gmail.com, zgf574564920@gmail.com, linux-damon@amazon.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC v3 09/15] mm/damon/dbgfs: Support prioritization weights Date: Tue, 20 Jul 2021 13:13:03 +0000 Message-Id: <20210720131309.22073-10-sj38.park@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210720131309.22073-1-sj38.park@gmail.com> References: <20210720131309.22073-1-sj38.park@gmail.com> Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=Utq+RpuM; spf=pass (imf16.hostedemail.com: domain of sj38park@gmail.com designates 209.85.219.42 as permitted sender) smtp.mailfrom=sj38park@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam02 X-Stat-Signature: aqojihu8tzdm1mypue5z33nf76qfeomu X-Rspamd-Queue-Id: 302E4F00009D X-HE-Tag: 1626786868-547068 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: From: SeongJae Park 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 | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c index 3cd253a07116..93ac15cb5786 100644 --- a/mm/damon/dbgfs.c +++ b/mm/damon/dbgfs.c @@ -227,13 +227,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; @@ -315,11 +318,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); @@ -1147,7 +1153,7 @@ static ssize_t dbgfs_monitor_on_write(struct file *file, static ssize_t dbgfs_version_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { - return simple_read_from_buffer(buf, count, ppos, "1\n", 2); + return simple_read_from_buffer(buf, count, ppos, "2\n", 2); } static const struct file_operations mk_contexts_fops = {