Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4532594pxj; Tue, 8 Jun 2021 17:10:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzv8WLsloSOALeAqMIvpyTSTDdKiCWoDHrtGlE8LiZkOmG3OsydQ0wk+wph0V3o3YsKFjc X-Received: by 2002:aa7:d5c9:: with SMTP id d9mr1347219eds.278.1623197414782; Tue, 08 Jun 2021 17:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623197414; cv=none; d=google.com; s=arc-20160816; b=bqXuweXOS0truAQm9kdnETAC8RSmaX2zwc06uAcipZICKDi8VzLMbqdYVpbDi34obt sUTUuPwozrJnihXoVP+EKFYHKIqUMGRUPumaiNRwOYp0t/3qMnn8PzGaPOpcTBr0HoDI Wx7W0Ha40/sO8k3RFYXWui/GUvNxeVFdfNI32iMs+XeD/wRUHsjI0zZvbW5vBL5EJ6ni 2ucaZYDuEQ8SIW1K++28zJe2yu8klrxk5C8oaSfv/95IuLqySBGZIls1yZ0XUnOlVxzL 54AQ3+PQdfYp6vo6Xk0oyse4d5IV+jWxJVbqWeeAa25lHG6gyv+fPmCXvfebP5L6OPBc QF2g== 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:message-id:date:subject :cc:to:from:dkim-signature; bh=exn5/9MVsYyepOBbFagm+4+x6JfQKNCd23hgVVQiw28=; b=QYLLbkTKjkSa7Z+ISUaG/okXvZY6IXZqewTy9fOstoCkIBkUug1Igd1X+oar2b/BC6 Hxm3LwjwBl38A/OcbOgg94nfHUACJZspXXzsqUwsS9PUeiqdZ6XZOjwJyaSRoWJAzIPc 8pZqAhL485Se0Hc8wDrgDAljV+pp4bMAYshZJWGqUmTsXlhp6tVAHnzFtGuZ6iVWad5J MpNyL0s60LddoV6E7IXFMM6sJAgeivgmx0747LVGWzaVVrmMyYQfujVKlRwIsf7puQhi enFdZRLCcUyFXOdRw9R6K/+SXXo/TBTMXyQnZnF6atMq/l3YupWyi/EsaRhw9vxYA4qR bOBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rW6VO0cY; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o4si834832edc.544.2021.06.08.17.09.47; Tue, 08 Jun 2021 17:10:14 -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=@gmail.com header.s=20161025 header.b=rW6VO0cY; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232381AbhFHLz3 (ORCPT + 99 others); Tue, 8 Jun 2021 07:55:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232374AbhFHLzY (ORCPT ); Tue, 8 Jun 2021 07:55:24 -0400 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C42DC06178B; Tue, 8 Jun 2021 04:53:30 -0700 (PDT) Received: by mail-qv1-xf30.google.com with SMTP id t6so4702170qvp.5; Tue, 08 Jun 2021 04:53:30 -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=exn5/9MVsYyepOBbFagm+4+x6JfQKNCd23hgVVQiw28=; b=rW6VO0cYPPeohtegDgnMo56MynBg4r79O6s7fPi4Hdgb4YViiGit5ckAJxLvBxTHKG I8FeR8VtXvr2EsTbwvkB1bkBqhxzyiVvac7rSpDQhZj/P7OOAUfHdMCQkqlAkdbbLgr3 kQFCw79tAR2RAt/tCkDe6g4r0ptta+kQEJ6fYily/2qY5EUGH27vOKm7tarHYyj7spii Yeoje3bC0c7/17CK7Hy2F44baCEKYEdfvrHfIh248bmIgT/c6nc9e4OBf60PVslSTSj2 x08zgiiqh6DG0CuZvXn+j0UXu6G+Q3T8n4pat88EsZSJey77bIC0MZiVQDfFutphW8K2 ySaA== 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=exn5/9MVsYyepOBbFagm+4+x6JfQKNCd23hgVVQiw28=; b=WrfWyamBQhmkRjUX+cRRAh0QG8KJiO+IEv0BPB6WpczZj3I5W5ILYI1VWR7v4qINBE zKo0iLYVjg4g0KqzgDp94TAnXKGUjxzeuuEtYOTSNO3D0dMmMKfaYkDMmmL+1SH0Cj+U uwIc8pY67BDnLvO5zYnv7PUaTg1yR/V+2tZQlF6bRJd4G1SjtayRQWp3bD9BiEsCHzZc LcZThJsQo1QF25jbdxj4l+ZNqONqppq5NGi5Rp4RbYTt+WbPqCIaODHHhXTIjPA3t32U zN//zM28EeSuziiptfGMQ4K27QbNipTiYYG+fiyRmfvksScjqAM5HjZ7ZfAZkgYcfz5k YnLQ== X-Gm-Message-State: AOAM532eMx+ZDw4a18/SVhsKcVDgtzty+qaX+tR7h8jiaFPSSbg4Q0VC bisVIMY0T8TKp/jnoyh428Y= X-Received: by 2002:a0c:a99c:: with SMTP id a28mr22979057qvb.33.1623153209315; Tue, 08 Jun 2021 04:53:29 -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 h4sm2133927qth.66.2021.06.08.04.53.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 04:53:28 -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, mgorman@suse.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, 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 v2 08/14] mm/damon/dbgfs: Support prioritization weights Date: Tue, 8 Jun 2021 11:52:48 +0000 Message-Id: <20210608115254.11930-9-sj38.park@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210608115254.11930-1-sj38.park@gmail.com> References: <20210608115254.11930-1-sj38.park@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ea6d4fdb57fa..b90287b1e576 100644 --- a/mm/damon/dbgfs.c +++ b/mm/damon/dbgfs.c @@ -227,11 +227,14 @@ 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\n", + "%lu %lu %u %u %u %u %d %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->limit.sz, s->limit.ms, + s->limit.weight_sz, + s->limit.weight_nr_accesses, + s->limit.weight_age, s->stat_count, s->stat_sz); if (!rc) return -ENOMEM; @@ -313,11 +316,14 @@ static struct damos **str_to_schemes(const char *str, ssize_t len, while (pos < len && *nr_schemes < max_nr_schemes) { struct damos_speed_limit limit = {}; - ret = sscanf(&str[pos], "%lu %lu %u %u %u %u %u %lu %lu%n", + ret = sscanf(&str[pos], + "%lu %lu %u %u %u %u %u %lu %lu %u %u %u%n", &min_sz, &max_sz, &min_nr_a, &max_nr_a, &min_age, &max_age, &action, &limit.sz, - &limit.ms, &parsed); - if (ret != 9) + &limit.ms, &limit.weight_sz, + &limit.weight_nr_accesses, &limit.weight_age, + &parsed); + if (ret != 12) break; if (!damos_action_valid(action)) { pr_err("wrong action %d\n", action); @@ -1141,7 +1147,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 = { -- 2.17.1