git: a02f9685edd1 - main - vm_meter: Add counter for NOFREE pages
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 07 Oct 2024 16:48:53 UTC
The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=a02f9685edd168ef51e2e6fd98f09c9b866fa9a9 commit a02f9685edd168ef51e2e6fd98f09c9b866fa9a9 Author: Bojan Novković <bnovkov@FreeBSD.org> AuthorDate: 2024-10-07 14:56:08 +0000 Commit: Bojan Novković <bnovkov@FreeBSD.org> CommitDate: 2024-10-07 16:46:32 +0000 vm_meter: Add counter for NOFREE pages This change adds a new counter that tracks the total number of permanently allocated pages. Differential Revision: https://reviews.freebsd.org/D46978 Reviewed by: alc, markj --- sys/sys/vmmeter.h | 8 ++++++++ sys/vm/vm_meter.c | 2 ++ sys/vm/vm_page.c | 1 + 3 files changed, 11 insertions(+) diff --git a/sys/sys/vmmeter.h b/sys/sys/vmmeter.h index 36321be22205..ac4d2f7e7c90 100644 --- a/sys/sys/vmmeter.h +++ b/sys/sys/vmmeter.h @@ -120,6 +120,7 @@ struct vmmeter { counter_u64_t v_rforkpages; /* (p) pages affected by rfork() */ counter_u64_t v_kthreadpages; /* (p) ... and by kernel fork() */ counter_u64_t v_wire_count; /* (p) pages wired down */ + counter_u64_t v_nofree_count; /* (p) permanently allocated pages */ #define VM_METER_NCOUNTERS \ (offsetof(struct vmmeter, v_page_size) / sizeof(counter_u64_t)) /* @@ -174,6 +175,13 @@ vm_wire_count(void) return (VM_CNT_FETCH(v_wire_count)); } +static inline u_int +vm_nofree_count(void) +{ + + return (VM_CNT_FETCH(v_nofree_count)); +} + /* * Return TRUE if we are under our severe low-free-pages threshold * diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index 7348577fc3cb..faf4074ef0c6 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -90,6 +90,7 @@ struct vmmeter __read_mostly vm_cnt = { .v_rforkpages = EARLY_COUNTER, .v_kthreadpages = EARLY_COUNTER, .v_wire_count = EARLY_COUNTER, + .v_nofree_count = EARLY_COUNTER, }; u_long __exclusive_cache_line vm_user_wire_count; @@ -386,6 +387,7 @@ VM_STATS_UINT(v_free_target, "Pages desired free"); VM_STATS_UINT(v_free_min, "Minimum low-free-pages threshold"); VM_STATS_PROC(v_free_count, "Free pages", vm_free_count); VM_STATS_PROC(v_wire_count, "Wired pages", vm_wire_count); +VM_STATS_PROC(v_nofree_count, "Permanently allocated pages", vm_nofree_count); VM_STATS_PROC(v_active_count, "Active pages", vm_active_count); VM_STATS_UINT(v_inactive_target, "Desired inactive pages"); VM_STATS_PROC(v_inactive_count, "Inactive pages", vm_inactive_count); diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 6256472e0336..67a9c2119ab8 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2594,6 +2594,7 @@ vm_page_alloc_nofree_domain(int domain, int req) } m = &nqp->ma[nqp->offs++]; vm_domain_free_unlock(vmd); + VM_CNT_ADD(v_nofree_count, 1); return (m); }