From 97038629572932dd817517a6a77ffdd4b25c8812 Mon Sep 17 00:00:00 2001 From: ngie Date: Sat, 11 Jun 2016 11:28:29 +0000 Subject: [PATCH] Redo MFC r300220,r300223: Differential Revision: https://reviews.freebsd.org/D6803 Reviewed by: alc, kib Sponsored by: EMC / Isilon Storage Division r300220 (by cem): sys/vmmeter.h: Fix trivial '-Wsign-compare' warning in common header Frankly, it doesn't make sense for vm_pageout_wakeup_thresh to have a negative value (it is only ever set to a fraction of v_free_min, which is unsigned and also obviously non-negative). But I'm not going to try and convert every non-negative scalar in the VM to unsigned today, so just cast it for the comparison. r300223 (by cem): vm/vm_page.h: Fix trivial '-Wpointer-sign' warning pq_vcnt, as a count of real things, has no business being negative. It is only ever initialized by a u_int counter. The warning came from the atomic_add_int() in vm_pagequeue_cnt_add(). Rectify the warning by changing the variable to u_int. No functional change. Suggested by: Clang 3.3 git-svn-id: svn://svn.freebsd.org/base/stable/10@301833 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/sys/vmmeter.h | 3 ++- sys/vm/vm_page.c | 4 ++-- sys/vm/vm_page.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/sys/vmmeter.h b/sys/sys/vmmeter.h index d2ad920a4..14bd8674a 100644 --- a/sys/sys/vmmeter.h +++ b/sys/sys/vmmeter.h @@ -183,7 +183,8 @@ static __inline int vm_paging_needed(void) { - return (cnt.v_free_count + cnt.v_cache_count < vm_pageout_wakeup_thresh); + return (cnt.v_free_count + cnt.v_cache_count < + (u_int)vm_pageout_wakeup_thresh); } #endif diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 512151bb2..c250c5ddb 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -253,11 +253,11 @@ vm_page_domain_init(struct vm_domain *vmd) *__DECONST(char **, &vmd->vmd_pagequeues[PQ_INACTIVE].pq_name) = "vm inactive pagequeue"; - *__DECONST(int **, &vmd->vmd_pagequeues[PQ_INACTIVE].pq_vcnt) = + *__DECONST(u_int **, &vmd->vmd_pagequeues[PQ_INACTIVE].pq_vcnt) = &cnt.v_inactive_count; *__DECONST(char **, &vmd->vmd_pagequeues[PQ_ACTIVE].pq_name) = "vm active pagequeue"; - *__DECONST(int **, &vmd->vmd_pagequeues[PQ_ACTIVE].pq_vcnt) = + *__DECONST(u_int **, &vmd->vmd_pagequeues[PQ_ACTIVE].pq_vcnt) = &cnt.v_active_count; vmd->vmd_page_count = 0; vmd->vmd_free_count = 0; diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 7ecb6c722..3ab4c24e1 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -215,7 +215,7 @@ struct vm_pagequeue { struct mtx pq_mutex; struct pglist pq_pl; int pq_cnt; - int * const pq_vcnt; + u_int * const pq_vcnt; const char * const pq_name; } __aligned(CACHE_LINE_SIZE); -- 2.45.0