summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2017-07-05 19:24:53 +0000
committermarkj <markj@FreeBSD.org>2017-07-05 19:24:53 +0000
commit54bfe395ec1166bb3db8eee35e64d6774f1b664a (patch)
treedc6e8a073c7bacb09dbdfe3a68f9902924eb268e /sys
parent075a14bf81a958bc369ed77ea3709527ea21a4e3 (diff)
downloadFreeBSD-src-54bfe395ec1166bb3db8eee35e64d6774f1b664a.zip
FreeBSD-src-54bfe395ec1166bb3db8eee35e64d6774f1b664a.tar.gz
MFS r320605, r320610: MFC r303052, r309017 (by alc):
Omit v_cache_count when computing the number of free pages, since its value is always 0. Approved by: re (gjb, kib)
Diffstat (limited to 'sys')
-rw-r--r--sys/cddl/compat/opensolaris/sys/kmem.h2
-rw-r--r--sys/compat/linprocfs/linprocfs.c2
-rw-r--r--sys/fs/tmpfs/tmpfs_subr.c3
-rw-r--r--sys/sys/vmmeter.h16
-rw-r--r--sys/vm/swap_pager.c4
-rw-r--r--sys/vm/vm_meter.c2
-rw-r--r--sys/vm/vm_page.c31
-rw-r--r--sys/vm/vm_pageout.c2
-rw-r--r--sys/vm/vnode_pager.c3
9 files changed, 28 insertions, 37 deletions
diff --git a/sys/cddl/compat/opensolaris/sys/kmem.h b/sys/cddl/compat/opensolaris/sys/kmem.h
index 5616067..c0e9760 100644
--- a/sys/cddl/compat/opensolaris/sys/kmem.h
+++ b/sys/cddl/compat/opensolaris/sys/kmem.h
@@ -77,7 +77,7 @@ void kmem_reap(void);
int kmem_debugging(void);
void *calloc(size_t n, size_t s);
-#define freemem (vm_cnt.v_free_count + vm_cnt.v_cache_count)
+#define freemem vm_cnt.v_free_count
#define minfree vm_cnt.v_free_min
#define heap_arena kmem_arena
#define kmem_alloc(size, kmflags) zfs_kmem_alloc((size), (kmflags))
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index cd85938..05258b2 100644
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -176,7 +176,7 @@ linprocfs_domeminfo(PFS_FILL_ARGS)
* like unstaticizing it just for linprocfs's sake.
*/
buffers = 0;
- cached = vm_cnt.v_cache_count * PAGE_SIZE;
+ cached = vm_cnt.v_inactive_count * PAGE_SIZE;
sbuf_printf(sb,
"MemTotal: %9lu kB\n"
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index 2aa879a..d247fbf 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -100,8 +100,7 @@ tmpfs_mem_avail(void)
{
vm_ooffset_t avail;
- avail = swap_pager_avail + vm_cnt.v_free_count + vm_cnt.v_cache_count -
- tmpfs_pages_reserved;
+ avail = swap_pager_avail + vm_cnt.v_free_count - tmpfs_pages_reserved;
if (__predict_false(avail < 0))
avail = 0;
return (avail);
diff --git a/sys/sys/vmmeter.h b/sys/sys/vmmeter.h
index 517be2d..745e895 100644
--- a/sys/sys/vmmeter.h
+++ b/sys/sys/vmmeter.h
@@ -118,7 +118,7 @@ struct vmmeter {
extern struct vmmeter vm_cnt;
-extern int vm_pageout_wakeup_thresh;
+extern u_int vm_pageout_wakeup_thresh;
/*
* Return TRUE if we are under our severe low-free-pages threshold
@@ -130,8 +130,7 @@ static inline int
vm_page_count_severe(void)
{
- return (vm_cnt.v_free_severe > vm_cnt.v_free_count +
- vm_cnt.v_cache_count);
+ return (vm_cnt.v_free_severe > vm_cnt.v_free_count);
}
/*
@@ -147,7 +146,7 @@ static inline int
vm_page_count_min(void)
{
- return (vm_cnt.v_free_min > vm_cnt.v_free_count + vm_cnt.v_cache_count);
+ return (vm_cnt.v_free_min > vm_cnt.v_free_count);
}
/*
@@ -158,8 +157,7 @@ static inline int
vm_page_count_target(void)
{
- return (vm_cnt.v_free_target > vm_cnt.v_free_count +
- vm_cnt.v_cache_count);
+ return (vm_cnt.v_free_target > vm_cnt.v_free_count);
}
/*
@@ -170,8 +168,7 @@ static inline int
vm_paging_target(void)
{
- return (vm_cnt.v_free_target - (vm_cnt.v_free_count +
- vm_cnt.v_cache_count));
+ return (vm_cnt.v_free_target - vm_cnt.v_free_count);
}
/*
@@ -181,8 +178,7 @@ static inline int
vm_paging_needed(void)
{
- return (vm_cnt.v_free_count + vm_cnt.v_cache_count <
- (u_int)vm_pageout_wakeup_thresh);
+ return (vm_cnt.v_free_count < vm_pageout_wakeup_thresh);
}
/*
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index b89a254..86c246c 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -2282,10 +2282,8 @@ swapoff_one(struct swdevt *sp, struct ucred *cred)
* of data we will have to page back in, plus an epsilon so
* the system doesn't become critically low on swap space.
*/
- if (vm_cnt.v_free_count + vm_cnt.v_cache_count + swap_pager_avail <
- nblks + nswap_lowat) {
+ if (vm_cnt.v_free_count + swap_pager_avail < nblks + nswap_lowat)
return (ENOMEM);
- }
/*
* Prevent further allocations on this device.
diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 6e2199e..8c9351c 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -204,7 +204,7 @@ vmtotal(SYSCTL_HANDLER_ARGS)
}
}
mtx_unlock(&vm_object_list_mtx);
- total.t_free = vm_cnt.v_free_count + vm_cnt.v_cache_count;
+ total.t_free = vm_cnt.v_free_count;
return (sysctl_handle_opaque(oidp, &total, sizeof(total), req));
}
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index ec721b2..9f4fe44 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -1561,11 +1561,11 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req)
* for the request class.
*/
mtx_lock(&vm_page_queue_free_mtx);
- if (vm_cnt.v_free_count + vm_cnt.v_cache_count > vm_cnt.v_free_reserved ||
+ if (vm_cnt.v_free_count > vm_cnt.v_free_reserved ||
(req_class == VM_ALLOC_SYSTEM &&
- vm_cnt.v_free_count + vm_cnt.v_cache_count > vm_cnt.v_interrupt_free_min) ||
+ vm_cnt.v_free_count > vm_cnt.v_interrupt_free_min) ||
(req_class == VM_ALLOC_INTERRUPT &&
- vm_cnt.v_free_count + vm_cnt.v_cache_count > 0)) {
+ vm_cnt.v_free_count > 0)) {
/*
* Can we allocate the page from a reservation?
*/
@@ -1752,11 +1752,11 @@ vm_page_alloc_contig(vm_object_t object, vm_pindex_t pindex, int req,
* below the lower bound for the allocation class?
*/
mtx_lock(&vm_page_queue_free_mtx);
- if (vm_cnt.v_free_count + vm_cnt.v_cache_count >= npages +
- vm_cnt.v_free_reserved || (req_class == VM_ALLOC_SYSTEM &&
- vm_cnt.v_free_count + vm_cnt.v_cache_count >= npages +
- vm_cnt.v_interrupt_free_min) || (req_class == VM_ALLOC_INTERRUPT &&
- vm_cnt.v_free_count + vm_cnt.v_cache_count >= npages)) {
+ if (vm_cnt.v_free_count >= npages + vm_cnt.v_free_reserved ||
+ (req_class == VM_ALLOC_SYSTEM &&
+ vm_cnt.v_free_count >= npages + vm_cnt.v_interrupt_free_min) ||
+ (req_class == VM_ALLOC_INTERRUPT &&
+ vm_cnt.v_free_count >= npages)) {
/*
* Can we allocate the pages from a reservation?
*/
@@ -1916,11 +1916,11 @@ vm_page_alloc_freelist(int flind, int req)
* Do not allocate reserved pages unless the req has asked for it.
*/
mtx_lock(&vm_page_queue_free_mtx);
- if (vm_cnt.v_free_count + vm_cnt.v_cache_count > vm_cnt.v_free_reserved ||
+ if (vm_cnt.v_free_count > vm_cnt.v_free_reserved ||
(req_class == VM_ALLOC_SYSTEM &&
- vm_cnt.v_free_count + vm_cnt.v_cache_count > vm_cnt.v_interrupt_free_min) ||
+ vm_cnt.v_free_count > vm_cnt.v_interrupt_free_min) ||
(req_class == VM_ALLOC_INTERRUPT &&
- vm_cnt.v_free_count + vm_cnt.v_cache_count > 0))
+ vm_cnt.v_free_count > 0))
m = vm_phys_alloc_freelist_pages(flind, VM_FREEPOOL_DIRECT, 0);
else {
mtx_unlock(&vm_page_queue_free_mtx);
@@ -2448,7 +2448,7 @@ vm_page_reclaim_contig(int req, u_long npages, vm_paddr_t low, vm_paddr_t high,
* Return if the number of free pages cannot satisfy the requested
* allocation.
*/
- count = vm_cnt.v_free_count + vm_cnt.v_cache_count;
+ count = vm_cnt.v_free_count;
if (count < npages + vm_cnt.v_free_reserved || (count < npages +
vm_cnt.v_interrupt_free_min && req_class == VM_ALLOC_SYSTEM) ||
(count < npages && req_class == VM_ALLOC_INTERRUPT))
@@ -2731,7 +2731,7 @@ vm_page_free_wakeup(void)
* some free.
*/
if (vm_pageout_pages_needed &&
- vm_cnt.v_cache_count + vm_cnt.v_free_count >= vm_cnt.v_pageout_free_min) {
+ vm_cnt.v_free_count >= vm_cnt.v_pageout_free_min) {
wakeup(&vm_pageout_pages_needed);
vm_pageout_pages_needed = 0;
}
@@ -3570,8 +3570,8 @@ vm_page_assert_pga_writeable(vm_page_t m, uint8_t bits)
DB_SHOW_COMMAND(page, vm_page_print_page_info)
{
+
db_printf("vm_cnt.v_free_count: %d\n", vm_cnt.v_free_count);
- db_printf("vm_cnt.v_cache_count: %d\n", vm_cnt.v_cache_count);
db_printf("vm_cnt.v_inactive_count: %d\n", vm_cnt.v_inactive_count);
db_printf("vm_cnt.v_active_count: %d\n", vm_cnt.v_active_count);
db_printf("vm_cnt.v_laundry_count: %d\n", vm_cnt.v_laundry_count);
@@ -3586,8 +3586,7 @@ DB_SHOW_COMMAND(pageq, vm_page_print_pageq_info)
{
int dom;
- db_printf("pq_free %d pq_cache %d\n",
- vm_cnt.v_free_count, vm_cnt.v_cache_count);
+ db_printf("pq_free %d\n", vm_cnt.v_free_count);
for (dom = 0; dom < vm_ndomains; dom++) {
db_printf(
"dom %d page_cnt %d free %d pq_act %d pq_inact %d pq_laund %d\n",
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index cd7bfb6..a8a19f3 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -159,7 +159,7 @@ SYSINIT(vmdaemon, SI_SUB_KTHREAD_VM, SI_ORDER_FIRST, kproc_start, &vm_kp);
#define VM_INACT_SCAN_RATE 2
int vm_pageout_deficit; /* Estimated number of pages deficit */
-int vm_pageout_wakeup_thresh;
+u_int vm_pageout_wakeup_thresh;
static int vm_pageout_oom_seq = 12;
bool vm_pageout_wanted; /* Event on which pageout daemon sleeps */
bool vm_pages_needed; /* Are threads waiting for free pages? */
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c
index efa72f38..06dff5e 100644
--- a/sys/vm/vnode_pager.c
+++ b/sys/vm/vnode_pager.c
@@ -1124,8 +1124,7 @@ vnode_pager_putpages(vm_object_t object, vm_page_t *m, int count,
* daemon up. This should be probably be addressed XXX.
*/
- if (vm_cnt.v_free_count + vm_cnt.v_cache_count <
- vm_cnt.v_pageout_free_min)
+ if (vm_cnt.v_free_count < vm_cnt.v_pageout_free_min)
flags |= VM_PAGER_PUT_SYNC;
/*
OpenPOWER on IntegriCloud