From patchwork Fri Feb 25 13:07:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12760227 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 0A93EC433EF for ; Fri, 25 Feb 2022 13:07:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 773528D0005; Fri, 25 Feb 2022 08:07:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D4648D0001; Fri, 25 Feb 2022 08:07:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 54D9A8D0005; Fri, 25 Feb 2022 08:07:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0026.hostedemail.com [216.40.44.26]) by kanga.kvack.org (Postfix) with ESMTP id 443E48D0001 for ; Fri, 25 Feb 2022 08:07:35 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 00886181BCDD2 for ; Fri, 25 Feb 2022 13:07:34 +0000 (UTC) X-FDA: 79181328828.16.0FF2977 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf25.hostedemail.com (Postfix) with ESMTP id 81814A001D for ; Fri, 25 Feb 2022 13:07:34 +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 ams.source.kernel.org (Postfix) with ESMTPS id 95676B830AA; Fri, 25 Feb 2022 13:07:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FDA6C340E7; Fri, 25 Feb 2022 13:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645794451; bh=BN0RNQE82EItJGsbrfD48UPrIRDNL1uB0fAkgBxI96s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PC/hsuXwwEBqFRHWJtWJUhNQAftRG8uhJbV8Ol1tOzcjoXuTywjB+QVZ9xEbr8bWr D+ZEViOzODjhZnMdEpK1TfqirM3TmIdFfav1j+9A2xlpwOfnAE7XSbWqzhqqk+x0L6 evdDnoEEkrJxV0yVCZq6HyHYqGH3hRlNBsfIV569eF8jzrUY29J6CjTBo9LWO3Z1cw MBUR4mcvVZyf5QHJnMSmJ1P56mOcVzpaxIf4q8ddcVP5ldNb/FIQMgwh9bQb70RWWO Jn7j6lxOOa93gp1PhGBWSTuRSZN0dsA55tnfnRUIpnJHNyXDoCSKCi1/hCDsJC6wQk w/GWThdyLjo0w== From: SeongJae Park To: akpm@linux-foundation.org Cc: corbet@lwn.net, skhan@linuxfoundation.org, rientjes@google.com, xhao@linux.alibaba.com, linux-damon@amazon.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH v2 02/13] mm/damon/core: Add number of each enum type values Date: Fri, 25 Feb 2022 13:07:01 +0000 Message-Id: <20220225130712.12682-3-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220225130712.12682-1-sj@kernel.org> References: <20220225130712.12682-1-sj@kernel.org> X-Rspamd-Queue-Id: 81814A001D X-Stat-Signature: 7beriszwxjugrfntub4jr3dgudesrngz X-Rspam-User: Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="PC/hsuXw"; spf=pass (imf25.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspamd-Server: rspam05 X-HE-Tag: 1645794454-682625 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 declares the number of legal values for each DAMON enum types to make traversals of such DAMON enum types easy and safe. Signed-off-by: SeongJae Park --- include/linux/damon.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index f8e99e47d747..f23cbfa4248d 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -87,6 +87,7 @@ struct damon_target { * @DAMOS_HUGEPAGE: Call ``madvise()`` for the region with MADV_HUGEPAGE. * @DAMOS_NOHUGEPAGE: Call ``madvise()`` for the region with MADV_NOHUGEPAGE. * @DAMOS_STAT: Do nothing but count the stat. + * @NR_DAMOS_ACTIONS: Total number of DAMOS actions */ enum damos_action { DAMOS_WILLNEED, @@ -95,6 +96,7 @@ enum damos_action { DAMOS_HUGEPAGE, DAMOS_NOHUGEPAGE, DAMOS_STAT, /* Do nothing but only record the stat */ + NR_DAMOS_ACTIONS, }; /** @@ -157,10 +159,12 @@ struct damos_quota { * * @DAMOS_WMARK_NONE: Ignore the watermarks of the given scheme. * @DAMOS_WMARK_FREE_MEM_RATE: Free memory rate of the system in [0,1000]. + * @NR_DAMOS_WMARK_METRICS: Total number of DAMOS watermark metrics */ enum damos_wmark_metric { DAMOS_WMARK_NONE, DAMOS_WMARK_FREE_MEM_RATE, + NR_DAMOS_WMARK_METRICS, }; /**