Date: Sun, 17 Feb 2019 16:35:19 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344231 - head/sys/vm Message-ID: <201902171635.x1HGZJCh037070@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Sun Feb 17 16:35:19 2019 New Revision: 344231 URL: https://svnweb.freebsd.org/changeset/base/344231 Log: Remove a redundant flag variable. Use the object pointer itself to determine whether the object is locked. No functional change intended. Reviewed by: kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D19215 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sun Feb 17 10:01:42 2019 (r344230) +++ head/sys/vm/vm_pageout.c Sun Feb 17 16:35:19 2019 (r344231) @@ -695,10 +695,9 @@ vm_pageout_launder(struct vm_domain *vmd, int launder, vm_page_t m, marker; int act_delta, error, numpagedout, queue, starting_target; int vnodes_skipped; - bool obj_locked, pageout_ok; + bool pageout_ok; mtx = NULL; - obj_locked = false; object = NULL; starting_target = launder; vnodes_skipped = 0; @@ -760,22 +759,16 @@ recheck: } if (object != m->object) { - if (obj_locked) { + if (object != NULL) VM_OBJECT_WUNLOCK(object); - obj_locked = false; - } object = m->object; - } - if (!obj_locked) { if (!VM_OBJECT_TRYWLOCK(object)) { mtx_unlock(mtx); /* Depends on type-stability. */ VM_OBJECT_WLOCK(object); - obj_locked = true; mtx_lock(mtx); goto recheck; - } else - obj_locked = true; + } } if (vm_page_busied(m)) @@ -897,17 +890,13 @@ free_page: vnodes_skipped++; } mtx = NULL; - obj_locked = false; + object = NULL; } } - if (mtx != NULL) { + if (mtx != NULL) mtx_unlock(mtx); - mtx = NULL; - } - if (obj_locked) { + if (object != NULL) VM_OBJECT_WUNLOCK(object); - obj_locked = false; - } vm_pagequeue_lock(pq); vm_pageout_end_scan(&ss); vm_pagequeue_unlock(pq); @@ -1368,7 +1357,6 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int sh vm_object_t object; int act_delta, addl_page_shortage, deficit, page_shortage; int starting_page_shortage; - bool obj_locked; /* * The addl_page_shortage is an estimate of the number of temporarily @@ -1388,7 +1376,6 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int sh starting_page_shortage = page_shortage = shortage + deficit; mtx = NULL; - obj_locked = false; object = NULL; vm_batchqueue_init(&rq); @@ -1446,22 +1433,16 @@ recheck: } if (object != m->object) { - if (obj_locked) { + if (object != NULL) VM_OBJECT_WUNLOCK(object); - obj_locked = false; - } object = m->object; - } - if (!obj_locked) { if (!VM_OBJECT_TRYWLOCK(object)) { mtx_unlock(mtx); /* Depends on type-stability. */ VM_OBJECT_WLOCK(object); - obj_locked = true; mtx_lock(mtx); goto recheck; - } else - obj_locked = true; + } } if (vm_page_busied(m)) { @@ -1563,14 +1544,10 @@ free_page: reinsert: vm_pageout_reinsert_inactive(&ss, &rq, m); } - if (mtx != NULL) { + if (mtx != NULL) mtx_unlock(mtx); - mtx = NULL; - } - if (obj_locked) { + if (object != NULL) VM_OBJECT_WUNLOCK(object); - obj_locked = false; - } vm_pageout_reinsert_inactive(&ss, &rq, NULL); vm_pageout_reinsert_inactive(&ss, &ss.bq, NULL); vm_pagequeue_lock(pq);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902171635.x1HGZJCh037070>