Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6976852rwn; Tue, 13 Sep 2022 11:46:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR4M8RynfS/iWmeDsu60WOHr+cUHpte9lVwYNC1Cl+RWA/TkGG3hHTecAg+bu5xNk1IV9vOR X-Received: by 2002:aa7:d994:0:b0:451:e570:8a7d with SMTP id u20-20020aa7d994000000b00451e5708a7dmr8240566eds.205.1663094792339; Tue, 13 Sep 2022 11:46:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663094792; cv=none; d=google.com; s=arc-20160816; b=Ou0OcL2MYDY2rr2z8XzHoipLBf3EJGWLp+HUIaTyH+syOj68lqsWeFQmhFda9nf+aV 7Hte/SAS2g6bJz0Yn5Lgw+8eLcHgVoEEq5719z0ojAKrVy37L5ZSDjGUrLFbQg6iVbYi m//6WNNebZzu1wuuQx2sdepHbSu1yWZwR4qTUYR5RW/F7DuSh8W1bOMlLG7u0xCjb1/X shEQ1yzJ5y3GUue7ZH81oAoopLVgcZOZgWIF+IbMzFsrVQBbUnM7TrIn6htdaCoaEYWb eWAHEuYmZrwW9HQv+5ATWwlF0kzHuBqQmGHNhVXCzSHTtexCld0CejF1vlfE/EhtmRoV priA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hdFsNJEVeg5TL0Cxk48K3n9d+ESY2QGjjM4oIzUOPeU=; b=caOZy26jwO2gIWD3PFhU0qO4unmFOYHKHA+X8Ka94D2bxsebavbDpckNHsUvV5KgIq kA1wNvliqitloVEOLHWVxYf1i6qSvBQAOoTEmpOmAzXlojAzpidQqdmnZMAtVWuMu/M+ gK7dsQKL0fBtHLE4fASFwEJzrojvCu6aRSRlAvF4LCAB00LM1ThVTas4jnsHbiPvG0HH Me394RuacwrjLyYxJIpkTg35LvLu+5oz5oBNgw9vzOr/QF1HrR3cXPtguNGgTiq0Jjhg nExWgHoa0DCdeSHRsdNtKtXz9u7jH4oMMbGGlknyw/ZXx8jpuJN1F+RTL10IKdjvpt/X At9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="QBYnta/2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm15-20020a170907948f00b0073d626e2ef8si10599376ejc.461.2022.09.13.11.46.06; Tue, 13 Sep 2022 11:46:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="QBYnta/2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231929AbiIMS2P (ORCPT + 99 others); Tue, 13 Sep 2022 14:28:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232569AbiIMS07 (ORCPT ); Tue, 13 Sep 2022 14:26:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D15D9659E9 for ; Tue, 13 Sep 2022 10:45:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E2CD7B80DCB for ; Tue, 13 Sep 2022 17:45:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41D7BC43140; Tue, 13 Sep 2022 17:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663091101; bh=ucRX7WkVCPXQIajil5D7e+L59pOLx2Mv/t/yKy7/hEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QBYnta/2AGgdSUfUisgCHWC65vMnHRWb5HvI3ucabhjRnXgU4A+2diqOC1pIausW/ 6hEar6RKEs6hAvo8D83Nq3z0u/51qnxVOo7kcMsDkgcLgzAVCWpsrdBeJynm7a6TTa k3mAQdnT0J0dNNB76+y4Rr1J7IaWHJL0cYNZ9zmipXrbWx0BLJBkh1LvAxAP6eH0J1 I+hCklmdP67C89sHRL0yL+gJ8zZuKb4xScKrmLNfOj6bsHukkVVEu/xRwGyXd7Dgid xUAarQyc6+MDXpxIDgG8PetXTzp2NqGDhUSladDw6OmX5df7xqI0fTRbMiYgKtd8VF tuGJxth1fI8+A== From: SeongJae Park To: SeongJae Park , Andrew Morton Cc: damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/22] mm/damon/lru_sort: use monitoring attributes parameters generaotr macro Date: Tue, 13 Sep 2022 17:44:37 +0000 Message-Id: <20220913174449.50645-11-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220913174449.50645-1-sj@kernel.org> References: <20220913174449.50645-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit makes DAMON_LRU_SORT to generate the module parameters for DAMON monitoring attributes using the generator macro to simplify the code and reduce duplicates. Signed-off-by: SeongJae Park --- mm/damon/lru_sort.c | 47 +++++---------------------------------------- 1 file changed, 5 insertions(+), 42 deletions(-) diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c index ade985b83652..e95626acee6f 100644 --- a/mm/damon/lru_sort.c +++ b/mm/damon/lru_sort.c @@ -13,6 +13,8 @@ #include #include +#include "modules-common.h" + #ifdef MODULE_PARAM_PREFIX #undef MODULE_PARAM_PREFIX #endif @@ -128,52 +130,13 @@ static unsigned long wmarks_low __read_mostly = 50; module_param(wmarks_low, ulong, 0600); static struct damon_attrs damon_lru_sort_mon_attrs = { - .sample_interval = 5000, - .aggr_interval = 100000, + .sample_interval = 5000, /* 5 ms */ + .aggr_interval = 100000, /* 100 ms */ .ops_update_interval = 0, .min_nr_regions = 10, .max_nr_regions = 1000, }; - -/* - * Sampling interval for the monitoring in microseconds. - * - * The sampling interval of DAMON for the hot/cold memory monitoring. Please - * refer to the DAMON documentation for more detail. 5 ms by default. - */ -module_param_named(sample_interval, damon_lru_sort_mon_attrs.sample_interval, - ulong, 0600); - -/* - * Aggregation interval for the monitoring in microseconds. - * - * The aggregation interval of DAMON for the hot/cold memory monitoring. - * Please refer to the DAMON documentation for more detail. 100 ms by default. - */ -module_param_named(aggr_interval, damon_lru_sort_mon_attrs.aggr_interval, ulong, - 0600); - -/* - * Minimum number of monitoring regions. - * - * The minimal number of monitoring regions of DAMON for the hot/cold memory - * monitoring. This can be used to set lower-bound of the monitoring quality. - * But, setting this too high could result in increased monitoring overhead. - * Please refer to the DAMON documentation for more detail. 10 by default. - */ -module_param_named(min_nr_regions, damon_lru_sort_mon_attrs.min_nr_regions, - ulong, 0600); - -/* - * Maximum number of monitoring regions. - * - * The maximum number of monitoring regions of DAMON for the hot/cold memory - * monitoring. This can be used to set upper-bound of the monitoring overhead. - * However, setting this too low could result in bad monitoring quality. - * Please refer to the DAMON documentation for more detail. 1000 by default. - */ -module_param_named(max_nr_regions, damon_lru_sort_mon_attrs.max_nr_regions, - ulong, 0600); +DEFINE_DAMON_MODULES_MON_ATTRS_PARAMS(damon_lru_sort_mon_attrs); /* * Start of the target memory region in physical address. -- 2.25.1