From patchwork Thu Jan 16 14:44:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 13941776 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 7622BC02188 for ; Thu, 16 Jan 2025 14:44:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 08CA7280001; Thu, 16 Jan 2025 09:44:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 015B56B0088; Thu, 16 Jan 2025 09:44:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA9ED280001; Thu, 16 Jan 2025 09:44:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B34146B0085 for ; Thu, 16 Jan 2025 09:44:49 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 69FB5A0DB7 for ; Thu, 16 Jan 2025 14:44:49 +0000 (UTC) X-FDA: 83013586698.20.11FF1E9 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by imf08.hostedemail.com (Postfix) with ESMTP id 8A66C16001E for ; Thu, 16 Jan 2025 14:44:47 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=HVEU8ZmQ; spf=pass (imf08.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.222.175 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737038687; 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=+B+QyGFJcFFPr4jLp7rJgEDbi3fOKEsn6Qh3/DdOqts=; b=RG4BIuq6xmlWEAqfdtPpCmgJeeJ8B1oeHw9u9cNhwQxpTJ0870AH5qouNr9uPaQNsDE91k r2M/brFDH6uTBET+XZm1qZhFGtKHQ5Tg8fBaRJf2mgdXW9kOlL9DySKHJa9LC4TJo6rPam Kh2gNGViTcHDTFiOHtjnlV6uwRiGyEM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737038687; a=rsa-sha256; cv=none; b=OeYUC25sNOcFNGNpCuiak0Fd9fvHlLDwVTh5v7Yz37L7mXlv251RyRqVTcJgf+q2Ohw5WV NmGqtP4xdAlDMJv2ic/1hIBl23IqBpLQqoe0EwIQRwlwBIgSgo8gyso3qEbymBz1yB3skz 45ClH1J4KeSdulUCN8DpeMB909c9Yyk= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=HVEU8ZmQ; spf=pass (imf08.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.222.175 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-7b702c3c021so90411385a.3 for ; Thu, 16 Jan 2025 06:44:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737038686; x=1737643486; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+B+QyGFJcFFPr4jLp7rJgEDbi3fOKEsn6Qh3/DdOqts=; b=HVEU8ZmQMhZR5m/MIoMoGtv5vmkUu9RzHxDQT30ryLGSdNfiyKzZ/y57W/MBJ8UrcZ p2gFKlryIeo94PslZTWVaCU+JnFMOB3uW3+xqZ98y7vVadSwbKhePzGUqCTGCibYZ9Bv s8XNXSE+SR8R6qPMysHYoVyNzj5g9G3sQe1eEmtDetGBtFvAOmkzMKFirpDKvSd7gUI2 sE6cagU3Lcd2mvsaJ20EOVEcfwYI7wau6REwY1VwQEpm9PKEOkAlyAhyAhsn382TjOLB YTLXD9c03TXILXjqo/WIVhbBrmBQf7g1fwIEeZJ2GhWFxJw+NdRdBjaueP2xXFU++I9G 9f2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737038686; x=1737643486; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+B+QyGFJcFFPr4jLp7rJgEDbi3fOKEsn6Qh3/DdOqts=; b=LAHYZFgjVukqW+YTMT2jHLj6hWrUl3lQf5zMTrwvFl/yrti93i3I9ce1d/zo7Bk4kH Cwy6HJm5cSTYb4EVfYWOfEn5RZh/HhkBQVHE5DyjTD2YAkCNhNTZ65lHKT0hfQzmtgtM Ni0KQv4te+HDrVKxaUULlUNFveXHN3l1myApdoIJ4PlKRck4SX619uoQrUEp13W6kX5I jd/WuUA2UXMc00/TAI1MdwvvLJVyNfgZqSk8gQZt7WWw16aAPHVfwcQL5e3h68ePKMZm f4KNP8fYSt29UtvhPpxMbY4kguNMFoH+e43h8JrZj1hL2NGUX/QP7lfoqkgAgsnsocVm gVYQ== X-Forwarded-Encrypted: i=1; AJvYcCV37Fcbwhm2cagjsMpfVot6XZx6moVogWDBLN53HPaU//cCiCXEmKP6QY7ya7kfKuqEwvw6LjH7Ww==@kvack.org X-Gm-Message-State: AOJu0Yw4adRe/b0iMEj/yBltwzS8NQkDVAxRJiTzGqFbr8ny3ak3APoy gOyeWb+Ro2rKIHACiS8ToYU86CtEUDZe0242H6V3wwZF5wbGGjCv X-Gm-Gg: ASbGncvcOOmQ1q1LtcvQnU1mQaYKfwVJFwFewD2O6gWrQAcvSpUBr6Bh9puQ66tZFIP waVui5gqn1VDkrZvWWTVkgBfJFIsfCA5ZlsiRY8i2wsodcfYg4+apPyuJcIuf5rx5M00jOp6f71 /xhI7jYz7m8VPks1m+DrbHu4fPhCdEWA3+UwrMIerG02dxmlypS4mg+YSqQ261QPR85EjbO1fPk SNtjJI7JDveNgLJ7aN5S8UmCnM6b370nKv9Oe4ilN+8tr066IZQNw== X-Google-Smtp-Source: AGHT+IEaNPPwv2jgmflcyY86b/WEwel2W1k8equ5GjnUoSfoOqjiDz0DmZNagpICpan2+ywzoOgFQw== X-Received: by 2002:a05:620a:45a7:b0:7b6:df08:367a with SMTP id af79cd13be357-7bcd970960amr5194628485a.23.1737038686573; Thu, 16 Jan 2025 06:44:46 -0800 (PST) Received: from localhost ([2a03:2880:20ff:6::]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be61487360sm10397985a.57.2025.01.16.06.44.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 06:44:46 -0800 (PST) From: Usama Arif To: sj@kernel.org, akpm@linux-foundation.org Cc: damon@lists.linux.dev, linux-mm@kvack.org, Usama Arif Subject: [v1 2/2] mm/damon: introduce DAMOS filter type hugepage Date: Thu, 16 Jan 2025 14:44:36 +0000 Message-ID: <20250116144436.3947318-2-usamaarif642@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250116144436.3947318-1-usamaarif642@gmail.com> References: <20250116144436.3947318-1-usamaarif642@gmail.com> MIME-Version: 1.0 X-Stat-Signature: p5ebt6s85omyha7tbhnre89ej9cr66hj X-Rspamd-Queue-Id: 8A66C16001E X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1737038687-84753 X-HE-Meta: U2FsdGVkX18R2trUO1O2CB9qpmbA48xL4f1xSXPEYkwyR+FQCuSkNEnwJg8SdASqik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6wmNM7yJbTyCanTN034yhVK+27wm6M58gDbXvlk7I2iiYD/YA+tRVJ3WH/q145pJ94wmyL43XzFzKbd0QnT2TwtWmjNCnvQiWGD2czZub4udi7mTGCxl4zGIYcv2sOQZw0urK/Lr9E7lfTWcDc6qEs9LoiR6msWzDRxB4v+usuQN4NiiZ9hNtHAH8F9ZMsQ3q1Zgv4bTqHBAOEHLdn0aUtHpL+L+/Y5OcHd8UtckX+Ctg4g1dEn8NVy+um9thc/aHwARjOLoYuejA+rnHT7QgM7E98I5Uo/5kAkFjB7vR1/k= X-Bogosity: Ham, tests=bogofilter, spamicity=0.004480, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is to gather statistics to check if hotest memory regions are backed by hugepages. This includes both THPs and hugetlbfs. This filter can help to observe and prove the effectivenes of different schemes for shrinking/collapsing hugepages. Signed-off-by: Usama Arif --- include/linux/damon.h | 2 ++ mm/damon/paddr.c | 3 +++ mm/damon/sysfs-schemes.c | 1 + 3 files changed, 6 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index af525252b853..1d94d7d88b36 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -326,6 +326,7 @@ struct damos_stat { * @DAMOS_FILTER_TYPE_ANON: Anonymous pages. * @DAMOS_FILTER_TYPE_MEMCG: Specific memcg's pages. * @DAMOS_FILTER_TYPE_YOUNG: Recently accessed pages. + * @DAMOS_FILTER_TYPE_HUGEPAGE: Page is part of a hugepage. * @DAMOS_FILTER_TYPE_ADDR: Address range. * @DAMOS_FILTER_TYPE_TARGET: Data Access Monitoring target. * @NR_DAMOS_FILTER_TYPES: Number of filter types. @@ -345,6 +346,7 @@ enum damos_filter_type { DAMOS_FILTER_TYPE_ANON, DAMOS_FILTER_TYPE_MEMCG, DAMOS_FILTER_TYPE_YOUNG, + DAMOS_FILTER_TYPE_HUGEPAGE, DAMOS_FILTER_TYPE_ADDR, DAMOS_FILTER_TYPE_TARGET, NR_DAMOS_FILTER_TYPES, diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index c0ccf4fade24..a9e69179d45c 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -222,6 +222,9 @@ static bool damos_pa_filter_match(struct damos_filter *filter, if (matched) damon_folio_mkold(folio); break; + case DAMOS_FILTER_TYPE_HUGEPAGE: + matched = folio_size(folio) == HPAGE_PMD_SIZE; + break; default: break; } diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 98f93ae9f59e..de9265f7ccde 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -329,6 +329,7 @@ static const char * const damon_sysfs_scheme_filter_type_strs[] = { "anon", "memcg", "young", + "hugepage", "addr", "target", };