aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2015-08-04 05:18:24 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2015-08-04 05:18:24 +0000
commitc1930470faeafaaebd50eea76b2a6ddaee8cc3c5 (patch)
tree4b88289264b83a06637fa69d7be085cfbfa1fb9b
parentd2cabdbe3fbea500f710864d13cf0cc8ea000415 (diff)
downloadsrc-c1930470faeafaaebd50eea76b2a6ddaee8cc3c5.tar.gz
src-c1930470faeafaaebd50eea76b2a6ddaee8cc3c5.zip
MFC r285878 (stable/10 r286145):
Revert r173708's modifications to vm_object_page_remove(). This fixes inconsistencies encountered by vm_object_unwire() or by the buffer cache when the file is truncated. Approved by: re (gjb)
Notes
Notes: svn path=/releng/10.2/; revision=286276
-rw-r--r--sys/vm/vm_object.c28
-rw-r--r--sys/vm/vm_object.h1
2 files changed, 5 insertions, 24 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index ab1562eda74f..36a2ead2ba3e 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -1063,9 +1063,9 @@ vm_object_sync(vm_object_t object, vm_ooffset_t offset, vm_size_t size,
*/
flags = OBJPR_NOTMAPPED;
else if (old_msync)
- flags = OBJPR_NOTWIRED;
+ flags = 0;
else
- flags = OBJPR_CLEANONLY | OBJPR_NOTWIRED;
+ flags = OBJPR_CLEANONLY;
vm_object_page_remove(object, OFF_TO_IDX(offset),
OFF_TO_IDX(offset + size + PAGE_MASK), flags);
}
@@ -1894,7 +1894,6 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t start, vm_pindex_t end,
int options)
{
vm_page_t p, next;
- int wirings;
VM_OBJECT_ASSERT_WLOCKED(object);
KASSERT((object->flags & OBJ_UNMANAGED) == 0 ||
@@ -1928,15 +1927,9 @@ again:
VM_OBJECT_WLOCK(object);
goto again;
}
- if ((wirings = p->wire_count) != 0 &&
- (wirings = pmap_page_wired_mappings(p)) != p->wire_count) {
- if ((options & (OBJPR_NOTWIRED | OBJPR_NOTMAPPED)) ==
- 0) {
+ if (p->wire_count != 0) {
+ if ((options & OBJPR_NOTMAPPED) == 0)
pmap_remove_all(p);
- /* Account for removal of wired mappings. */
- if (wirings != 0)
- p->wire_count -= wirings;
- }
if ((options & OBJPR_CLEANONLY) == 0) {
p->valid = 0;
vm_page_undirty(p);
@@ -1957,19 +1950,8 @@ again:
if (p->dirty)
goto next;
}
- if ((options & OBJPR_NOTMAPPED) == 0) {
- if ((options & OBJPR_NOTWIRED) != 0 && wirings != 0)
- goto next;
+ if ((options & OBJPR_NOTMAPPED) == 0)
pmap_remove_all(p);
- /* Account for removal of wired mappings. */
- if (wirings != 0) {
- KASSERT(p->wire_count == wirings,
- ("inconsistent wire count %d %d %p",
- p->wire_count, wirings, p));
- p->wire_count = 0;
- atomic_subtract_int(&cnt.v_wire_count, 1);
- }
- }
vm_page_free(p);
next:
vm_page_unlock(p);
diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h
index 8f65b4225230..06111a124b15 100644
--- a/sys/vm/vm_object.h
+++ b/sys/vm/vm_object.h
@@ -207,7 +207,6 @@ struct vm_object {
*/
#define OBJPR_CLEANONLY 0x1 /* Don't remove dirty pages. */
#define OBJPR_NOTMAPPED 0x2 /* Don't unmap pages. */
-#define OBJPR_NOTWIRED 0x4 /* Don't remove wired pages. */
TAILQ_HEAD(object_q, vm_object);