From owner-svn-src-head@freebsd.org Wed Jun 14 03:55:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DA98C792D5; Wed, 14 Jun 2017 03:55:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC893780D9; Wed, 14 Jun 2017 03:55:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5E3tBKA057539; Wed, 14 Jun 2017 03:55:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5E3tBBm057538; Wed, 14 Jun 2017 03:55:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201706140355.v5E3tBBm057538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 14 Jun 2017 03:55:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319934 - head/sys/dev/md X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jun 2017 03:55:13 -0000 Author: markj Date: Wed Jun 14 03:55:11 2017 New Revision: 319934 URL: https://svnweb.freebsd.org/changeset/base/319934 Log: Don't call vm_pager_page_unswapped() when writing or deleting a dirty page. The swap space backing a clean page is released when it is first dirtied, so there's no need to attempt to release swap space when the page is already dirty. Reviewed by: alc MFC after: 1 week Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Wed Jun 14 03:50:02 2017 (r319933) +++ head/sys/dev/md/md.c Wed Jun 14 03:55:11 2017 (r319934) @@ -1076,8 +1076,10 @@ mdstart_swap(struct md_s *sc, struct bio *bp) } m->valid = VM_PAGE_BITS_ALL; - vm_page_dirty(m); - vm_pager_page_unswapped(m); + if (m->dirty != VM_PAGE_BITS_ALL) { + vm_page_dirty(m); + vm_pager_page_unswapped(m); + } } else if (bp->bio_cmd == BIO_DELETE) { if (len == PAGE_SIZE || m->valid == VM_PAGE_BITS_ALL) rv = VM_PAGER_OK; @@ -1094,10 +1096,12 @@ mdstart_swap(struct md_s *sc, struct bio *bp) /* Page is valid. */ if (len != PAGE_SIZE) { pmap_zero_page_area(m, offs, len); - vm_page_dirty(m); - } - vm_pager_page_unswapped(m); - if (len == PAGE_SIZE) { + if (m->dirty != VM_PAGE_BITS_ALL) { + vm_page_dirty(m); + vm_pager_page_unswapped(m); + } + } else { + vm_pager_page_unswapped(m); md_swap_page_free(m); m = NULL; }