Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Dec 2015 23:24:10 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r292893 - projects/sendfile/sys/kern
Message-ID:  <201512292324.tBTNOAxk022690@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512292324.tBTNOAxk022690>