From owner-svn-src-projects@freebsd.org Tue Dec 29 23:24:11 2015 Return-Path: Delivered-To: svn-src-projects@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 9CF61A546E5 for ; Tue, 29 Dec 2015 23:24:11 +0000 (UTC) (envelope-from glebius@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 6A4321B2A; Tue, 29 Dec 2015 23:24:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTNOAZb022691; Tue, 29 Dec 2015 23:24:10 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTNOAxk022690; Tue, 29 Dec 2015 23:24:10 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201512292324.tBTNOAxk022690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 29 Dec 2015 23:24:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r292893 - projects/sendfile/sys/kern X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2015 23:24:11 -0000 Author: glebius Date: Tue Dec 29 23:24:10 2015 New Revision: 292893 URL: https://svnweb.freebsd.org/changeset/base/292893 Log: A temporary fixup for the new sendfile + new pager KPI. The new sendfile still manages its readahead itself, so it needs to record the boundary between wired pages (part of the actual request) and non-wired pages (readahead). In sf_iodone() these pages need to be treated differently. Modified: projects/sendfile/sys/kern/uipc_syscalls.c Modified: projects/sendfile/sys/kern/uipc_syscalls.c ============================================================================== --- projects/sendfile/sys/kern/uipc_syscalls.c Tue Dec 29 23:16:20 2015 (r292892) +++ projects/sendfile/sys/kern/uipc_syscalls.c Tue Dec 29 23:24:10 2015 (r292893) @@ -2079,6 +2079,7 @@ struct sf_io { int npages; struct file *sock_fp; struct mbuf *m; + vm_pindex_t last_wired; vm_page_t pa[]; }; @@ -2088,13 +2089,16 @@ sf_iodone(void *arg, vm_page_t *pg, int struct sf_io *sfio = arg; struct socket *so; - if (pg) { - for (int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { + if (pg[i]->pindex <= sfio->last_wired) vm_page_xunbusy(pg[i]); - if (error) - sfio->error = error; + else + vm_page_readahead_finish(pg[i]); } + if (error) + sfio->error = error; + if (!refcount_release(&sfio->nios)) return; @@ -2160,6 +2164,9 @@ sendfile_swapin(vm_object_t obj, struct } } + if (npages > 0) + sfio->last_wired = pa[npages - 1]->pindex; + for (int i = 0; i < npages;) { int j, a, count, rv;