From owner-svn-src-projects@FreeBSD.ORG Sun Nov 30 09:56:14 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1F4FB49F; Sun, 30 Nov 2014 09:56:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 0B186EBB; Sun, 30 Nov 2014 09:56:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAU9uDi0071043; Sun, 30 Nov 2014 09:56:13 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAU9uD6o071042; Sun, 30 Nov 2014 09:56:13 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201411300956.sAU9uD6o071042@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sun, 30 Nov 2014 09:56:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275308 - 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.18-1 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: Sun, 30 Nov 2014 09:56:14 -0000 Author: glebius Date: Sun Nov 30 09:56:13 2014 New Revision: 275308 URL: https://svnweb.freebsd.org/changeset/base/275308 Log: Pager limits our readahead count to MAXPHYS, so do not try to pre-allocate larger vector. 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 Sun Nov 30 09:04:24 2014 (r275307) +++ projects/sendfile/sys/kern/uipc_syscalls.c Sun Nov 30 09:56:13 2014 (r275308) @@ -2467,11 +2467,13 @@ retry_space: /* * Calculate maximum allowed number of pages for readahead * at this iteration. First, we allow readahead up to "rem". - * If application wants more, let it be. But check against - * "obj_size", since vm_pager_has_page() can hint beyond EOF. + * If application wants more, let it be, but there is no + * reason to go above MAXPHYS. Also check against "obj_size", + * since vm_pager_has_page() can hint beyond EOF. */ rhpages = howmany(rem + (off & PAGE_MASK), PAGE_SIZE) - npages; rhpages = max(SF_READAHEAD(flags), rhpages); + rhpages = min(howmany(MAXPHYS, PAGE_SIZE), rhpages); rhpages = min(howmany(obj_size - trunc_page(off), PAGE_SIZE) - npages, rhpages);