From owner-dev-commits-src-all@freebsd.org Sat May 22 09:46:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8284648DE9; Sat, 22 May 2021 09:46:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJX14rrvz3ljZ; Sat, 22 May 2021 09:46:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CE6D2215D; Sat, 22 May 2021 09:46:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kPPr012363; Sat, 22 May 2021 09:46:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kPJn012362; Sat, 22 May 2021 09:46:25 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:25 GMT Message-Id: <202105220946.14M9kPJn012362@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: f3b6b7de3cc0 - stable/13 - vm_pager: add pgo_set_writeable_dirty method MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f3b6b7de3cc0b3379b9ed991cc3d4980eedf17b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:25 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f3b6b7de3cc0b3379b9ed991cc3d4980eedf17b1 commit f3b6b7de3cc0b3379b9ed991cc3d4980eedf17b1 Author: Konstantin Belousov AuthorDate: 2021-05-01 00:14:48 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:28 +0000 vm_pager: add pgo_set_writeable_dirty method (cherry picked from commit 180bcaa46c5d297d137749258b23593d578d76a5) --- sys/vm/swap_pager.c | 9 +++++++++ sys/vm/vm_object.c | 7 +------ sys/vm/vm_object.h | 1 + sys/vm/vm_pager.c | 11 +++++++++++ sys/vm/vm_pager.h | 3 ++- sys/vm/vnode_pager.c | 1 + 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index fa0aa0c41925..8ccc3a6710e0 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -433,6 +433,7 @@ static void swap_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); static void swap_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); +static void swap_pager_set_writeable_dirty(vm_object_t object); struct pagerops swappagerops = { .pgo_init = swap_pager_init, /* early system initialization of pager */ @@ -445,6 +446,7 @@ struct pagerops swappagerops = { .pgo_pageunswapped = swap_pager_unswapped, /* remove swap related to page */ .pgo_update_writecount = swap_pager_update_writecount, .pgo_release_writecount = swap_pager_release_writecount, + .pgo_set_writeable_dirty = swap_pager_set_writeable_dirty, }; /* @@ -3127,3 +3129,10 @@ swap_pager_release_writecount(vm_object_t object, vm_offset_t start, object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start; VM_OBJECT_WUNLOCK(object); } + +static void +swap_pager_set_writeable_dirty(vm_object_t object) +{ + if ((object->flags & OBJ_TMPFS_NODE) != 0) + vm_object_set_writeable_dirty_(object); +} diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 1f5194464b69..46b43e8cee14 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2332,13 +2332,8 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset_t prev_offset, } void -vm_object_set_writeable_dirty(vm_object_t object) +vm_object_set_writeable_dirty_(vm_object_t object) { - - /* Only set for vnodes & tmpfs */ - if (object->type != OBJT_VNODE && - (object->flags & OBJ_TMPFS_NODE) == 0) - return; atomic_add_int(&object->generation, 1); } diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 3c589bd4b42e..93380d904526 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -378,6 +378,7 @@ void vm_object_deallocate (vm_object_t); void vm_object_destroy (vm_object_t); void vm_object_terminate (vm_object_t); void vm_object_set_writeable_dirty (vm_object_t); +void vm_object_set_writeable_dirty_(vm_object_t object); void vm_object_init (void); int vm_object_kvme_type(vm_object_t object, struct vnode **vpp); void vm_object_madvise(vm_object_t, vm_pindex_t, vm_pindex_t, int); diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 2a30a2073b36..258c06fd3947 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -497,3 +497,14 @@ pbrelbo(struct buf *bp) bp->b_bufobj = NULL; bp->b_flags &= ~B_PAGING; } + +void +vm_object_set_writeable_dirty(vm_object_t object) +{ + pgo_set_writeable_dirty_t *method; + + method = pagertab[object->type]->pgo_set_writeable_dirty; + if (method != NULL) + method(object); +} + diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 2dfe374b9d4a..e17e29ea961f 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -62,6 +62,7 @@ typedef int pgo_populate_t(vm_object_t, vm_pindex_t, int, vm_prot_t, vm_pindex_t *, vm_pindex_t *); typedef void pgo_pageunswapped_t(vm_page_t); typedef void pgo_writecount_t(vm_object_t, vm_offset_t, vm_offset_t); +typedef void pgo_set_writeable_dirty_t(vm_object_t); struct pagerops { pgo_init_t *pgo_init; /* Initialize pager. */ @@ -73,9 +74,9 @@ struct pagerops { pgo_haspage_t *pgo_haspage; /* Query page. */ pgo_populate_t *pgo_populate; /* Bulk spec pagein. */ pgo_pageunswapped_t *pgo_pageunswapped; - /* Operations for specialized writecount handling */ pgo_writecount_t *pgo_update_writecount; pgo_writecount_t *pgo_release_writecount; + pgo_set_writeable_dirty_t *pgo_set_writeable_dirty; }; extern struct pagerops defaultpagerops; diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index e75c6fb6b5d7..619121b672eb 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -115,6 +115,7 @@ struct pagerops vnodepagerops = { .pgo_haspage = vnode_pager_haspage, .pgo_update_writecount = vnode_pager_update_writecount, .pgo_release_writecount = vnode_pager_release_writecount, + .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, }; static struct domainset *vnode_domainset = NULL;