Date: Sun, 14 Jun 2015 20:23:41 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284387 - head/sys/vm Message-ID: <201506142023.t5EKNgNo011006@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sun Jun 14 20:23:41 2015 New Revision: 284387 URL: https://svnweb.freebsd.org/changeset/base/284387 Log: Invalid pages do not need neither update of the activation count nor they coould be dirty. Move the handling if the invalid pages in the inactive scan earlier. Remove some code duplication in the scan by introducing the 'drop_page' label, which centralizes the object and the page unlock. Suggested and reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sun Jun 14 20:16:36 2015 (r284386) +++ head/sys/vm/vm_pageout.c Sun Jun 14 20:23:41 2015 (r284387) @@ -1159,6 +1159,17 @@ vm_pageout_scan(struct vm_domain *vmd, i queues_locked = FALSE; /* + * Invalid pages can be easily freed. They cannot be + * mapped, vm_page_free() asserts this. + */ + if (m->valid == 0 && m->hold_count == 0) { + vm_page_free(m); + PCPU_INC(cnt.v_dfree); + --page_shortage; + goto drop_page; + } + + /* * We bump the activation count if the page has been * referenced while in the inactive queue. This makes * it less likely that the page will be added back to the @@ -1192,15 +1203,10 @@ vm_pageout_scan(struct vm_domain *vmd, i queues_locked = TRUE; vm_page_requeue_locked(m); } - VM_OBJECT_WUNLOCK(object); - vm_page_unlock(m); - goto relock_queues; + goto drop_page; } if (m->hold_count != 0) { - vm_page_unlock(m); - VM_OBJECT_WUNLOCK(object); - /* * Held pages are essentially stuck in the * queue. So, they ought to be discounted @@ -1209,7 +1215,7 @@ vm_pageout_scan(struct vm_domain *vmd, i * loop over the active queue below. */ addl_page_shortage++; - goto relock_queues; + goto drop_page; } /* @@ -1224,14 +1230,7 @@ vm_pageout_scan(struct vm_domain *vmd, i if (m->dirty == 0 && object->ref_count != 0) pmap_remove_all(m); - if (m->valid == 0) { - /* - * Invalid pages can be easily freed - */ - vm_page_free(m); - PCPU_INC(cnt.v_dfree); - --page_shortage; - } else if (m->dirty == 0) { + if (m->dirty == 0) { /* * Clean pages can be freed. */ @@ -1305,6 +1304,7 @@ vm_pageout_scan(struct vm_domain *vmd, i vm_page_lock_assert(m, MA_NOTOWNED); goto relock_queues; } +drop_page: vm_page_unlock(m); VM_OBJECT_WUNLOCK(object); relock_queues:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506142023.t5EKNgNo011006>