Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Nov 2014 12:39:51 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r274963 - projects/sendfile/sys/kern
Message-ID:  <201411241239.sAOCdpe0025479@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Mon Nov 24 12:39:50 2014
New Revision: 274963
URL: https://svnweb.freebsd.org/changeset/base/274963

Log:
  Even if application specified zero readahead, but current sendfile_swapin()
  run is limited by socket space, not by the "nbytes" argument, do readahead.
  
  Sponsored by:	Netflix
  Sponsored by:	Nginx, Inc.

Modified:
  projects/sendfile/sys/kern/uipc_syscalls.c

Modified: projects/sendfile/sys/kern/uipc_syscalls.c
==============================================================================
--- projects/sendfile/sys/kern/uipc_syscalls.c	Mon Nov 24 11:37:27 2014	(r274962)
+++ projects/sendfile/sys/kern/uipc_syscalls.c	Mon Nov 24 12:39:50 2014	(r274963)
@@ -2468,8 +2468,10 @@ retry_space:
 		else
 			npages = howmany(space, PAGE_SIZE);
 
+		rhpages = SF_READAHEAD(flags) ?
+		    SF_READAHEAD(flags) : roundup2(rem - space, PAGE_SIZE);
 		rhpages = min(howmany(obj_size - (off & ~PAGE_MASK) -
-		    (npages * PAGE_SIZE), PAGE_SIZE), SF_READAHEAD(flags));
+		    (npages * PAGE_SIZE), PAGE_SIZE), rhpages);
 
 		sfio = malloc(sizeof(struct sf_io) +
 		    (rhpages + npages) * sizeof(vm_page_t), M_TEMP, M_WAITOK);



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