From patchwork Wed Feb 23 15:20:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 546049 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2ADFC433F5 for ; Wed, 23 Feb 2022 15:21:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241837AbiBWPVw (ORCPT ); Wed, 23 Feb 2022 10:21:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241810AbiBWPVv (ORCPT ); Wed, 23 Feb 2022 10:21:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4FC8A994F; Wed, 23 Feb 2022 07:21:23 -0800 (PST) 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 72E566176A; Wed, 23 Feb 2022 15:21:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2F02C340F4; Wed, 23 Feb 2022 15:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645629682; bh=BN0RNQE82EItJGsbrfD48UPrIRDNL1uB0fAkgBxI96s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tmdu6BbGIL9dViUeGrJV6pREGGl2cRHl6Ig1wrvLHrAhms16KMJylv2WC2h/OP2Y8 aiB3eW5pocgUaCaVtOgGPfn6rb1lMiU0uP1Iat4/aR1IpstppVckiV7zIpvh7pzepJ lKchc2ELAQ7K+EzF7T3LhRdvpBlA5/8fgfW3vicRoysu745VZnt8Q3yQD+WiL7R39H NfTgRjd2gpxTedP1k7wlh9gGWtgcNoB/wuqY2VpJb9rFOOIYMweSNsBwqbhyKtixhQ AuSW8Ep6AohkcQWISjVkDVK7ZhbrNGOq2leqLxq2BQx6QDocD9liURxU1garqoJoH1 V7L5C07WO/gWA== 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 02/12] mm/damon/core: Add number of each enum type values Date: Wed, 23 Feb 2022 15:20:41 +0000 Message-Id: <20220223152051.22936-3-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220223152051.22936-1-sj@kernel.org> References: <20220223152051.22936-1-sj@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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, }; /**