From patchwork Tue Sep 13 17:44:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12975080 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD6EDC6FA8A for ; Tue, 13 Sep 2022 17:45:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7AC258000C; Tue, 13 Sep 2022 13:45:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 620508000A; Tue, 13 Sep 2022 13:45:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44BDB8000C; Tue, 13 Sep 2022 13:45:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2C4B38000A for ; Tue, 13 Sep 2022 13:45:03 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0C652802E3 for ; Tue, 13 Sep 2022 17:45:02 +0000 (UTC) X-FDA: 79907788086.26.4FD4D93 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id 684161400AF for ; Tue, 13 Sep 2022 17:45:02 +0000 (UTC) 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 dfw.source.kernel.org (Postfix) with ESMTPS id CAA9B61268; Tue, 13 Sep 2022 17:45:01 +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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663091102; a=rsa-sha256; cv=none; b=f90Uhurp0smaIEODIN5e9N78+NVDxAmjjdCTHQbTkoCOtGEe/ZUvepzjUnseZg2Cfsbl9n 7imqg/9X2D0250pobDzu68tpHpH5jeQQTgmM6X+Zb4VdmTC/7n3cd+4KFqH7nX5bhvA1pH Cv+AlhxSGV8beDetlLpucKisg/VGVHo= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="QBYnta/2"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663091102; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hdFsNJEVeg5TL0Cxk48K3n9d+ESY2QGjjM4oIzUOPeU=; b=px9MEUnN6sfar5tyLa2ih5TRL3abzhYDbgJNLRV0nerFhbJIohjBsj0vaBcLuS20Q5tI9q JbGIrTktl2Yz5O4CHnC1Fv3Au1V5NWz/7/krFsWFA24SIo7cp5DxJh+2rziqEULiQrRePY 8IfH2+9Mg3gpNKkXqMFQa7Imdg8dJeo= Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="QBYnta/2"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: uq5i8mnt8d8d999941yhhz45b53ggmnb X-Rspamd-Queue-Id: 684161400AF X-HE-Tag: 1663091102-101475 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 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.