From: kaiyang2@cs.cmu.edu
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Kaiyang Zhao <kaiyang2@cs.cmu.edu>,
hannes@cmpxchg.org, ziy@nvidia.com, dskarlat@cs.cmu.edu
Subject: [RFC PATCH 7/7] exports the number of pages scanned on behalf of movable/unmovable allocations
Date: Wed, 20 Mar 2024 02:42:18 +0000 [thread overview]
Message-ID: <20240320024218.203491-8-kaiyang2@cs.cmu.edu> (raw)
In-Reply-To: <20240320024218.203491-1-kaiyang2@cs.cmu.edu>
From: Kaiyang Zhao <kaiyang2@cs.cmu.edu>
exports the number of pages scanned on behalf of movable/unmovable
allocations in vmstat
Signed-off-by: Kaiyang Zhao <zh_kaiyang@hotmail.com>
---
include/linux/vm_event_item.h | 2 ++
mm/vmscan.c | 11 +++++++++++
mm/vmstat.c | 2 ++
3 files changed, 15 insertions(+)
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index c9183117c8f7..dcfff56c6d29 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -50,6 +50,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
PGSCAN_DIRECT_THROTTLE,
PGSCAN_ANON,
PGSCAN_FILE,
+ PGSCAN_MOVABLE, /* number of pages scanned on behalf of a movable allocation */
+ PGSCAN_UNMOVABLE,
PGSTEAL_ANON,
PGSTEAL_FILE,
#ifdef CONFIG_NUMA
diff --git a/mm/vmscan.c b/mm/vmscan.c
index ed0f47e2e810..4eadf0254918 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -904,6 +904,12 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl,
cond_resched();
}
+ /* Arbitrarily consider 16 pages scanned */
+ if (is_migrate_movable(gfp_migratetype(shrinkctl->gfp_mask)))
+ count_vm_events(PGSCAN_MOVABLE, 16);
+ else
+ count_vm_events(PGSCAN_UNMOVABLE, 16);
+
/*
* The deferred work is increased by any new work (delta) that wasn't
* done, decreased by old deferred work that was done now.
@@ -2580,6 +2586,11 @@ static unsigned long shrink_inactive_list(unsigned long nr_to_scan,
__count_memcg_events(lruvec_memcg(lruvec), item, nr_scanned);
__count_vm_events(PGSCAN_ANON + file, nr_scanned);
+ if (is_migrate_movable(gfp_migratetype(sc->gfp_mask)))
+ __count_vm_events(PGSCAN_MOVABLE, nr_scanned);
+ else
+ __count_vm_events(PGSCAN_UNMOVABLE, nr_scanned);
+
spin_unlock_irq(&lruvec->lru_lock);
if (nr_taken == 0)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 444740605f2f..56062d53a36c 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1281,6 +1281,8 @@ const char * const vmstat_text[] = {
"pgscan_direct_throttle",
"pgscan_anon",
"pgscan_file",
+ "pgscan_by_movable",
+ "pgscan_by_unmovable",
"pgsteal_anon",
"pgsteal_file",
--
2.40.1
next prev parent reply other threads:[~2024-03-20 2:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-20 2:42 [RFC PATCH 0/7] mm: providing ample physical memory contiguity by confining unmovable allocations kaiyang2
2024-03-20 2:42 ` [RFC PATCH 1/7] sysfs interface for the boundary of movable zone kaiyang2
2024-03-20 2:42 ` [RFC PATCH 2/7] Disallows high-order movable allocations in other zones if ZONE_MOVABLE is populated kaiyang2
2024-03-20 2:42 ` [RFC PATCH 3/7] compaction accepts a destination zone kaiyang2
2024-03-20 2:42 ` [RFC PATCH 4/7] vmstat counter for pages migrated across zones kaiyang2
2024-03-20 2:42 ` [RFC PATCH 5/7] proactively move pages out of unmovable zones in kcompactd kaiyang2
2024-03-20 2:42 ` [RFC PATCH 6/7] pass gfp mask of the allocation that waked kswapd to track number of pages scanned on behalf of each alloc type kaiyang2
2024-03-20 2:42 ` kaiyang2 [this message]
2024-03-20 2:47 ` [RFC PATCH 0/7] mm: providing ample physical memory contiguity by confining unmovable allocations Zi Yan
2024-03-20 2:57 ` kaiyang2
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240320024218.203491-8-kaiyang2@cs.cmu.edu \
--to=kaiyang2@cs.cmu.edu \
--cc=dskarlat@cs.cmu.edu \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox