From owner-svn-src-head@FreeBSD.ORG Tue May 7 08:16:22 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1D419CFA; Tue, 7 May 2013 08:16:22 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E91357A5; Tue, 7 May 2013 08:16:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r478GL3X002833; Tue, 7 May 2013 08:16:21 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r478GL1X002832; Tue, 7 May 2013 08:16:21 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201305070816.r478GL1X002832@svn.freebsd.org> From: Scott Long Date: Tue, 7 May 2013 08:16:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250327 - head/sys/kern 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.14 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: Tue, 07 May 2013 08:16:22 -0000 Author: scottl Date: Tue May 7 08:16:21 2013 New Revision: 250327 URL: http://svnweb.freebsd.org/changeset/base/250327 Log: Add a sysctl vfs.read_min to complement the exiting vfs.read_max. It defaults to 1, meaning that it's off. When read-ahead is enabled on a file, the vfs cluster code deliberately breaks a read into 2 I/O transactions; one to satisfy the actual read, and one to perform read-ahead. This makes sense in low-latency circumstances, but often produces unbalanced i/o transactions that penalize disks. By setting vfs.read_min, we can tell the algorithm to fetch a larger transaction that what we asked for, achieving the same effect as the read-ahead but without the doubled, unbalanced transaction and the slightly lower latency. This significantly helps our workloads with video streaming. Submitted by: emax Reviewed by: kib Obtained from: Netflix Modified: head/sys/kern/vfs_cluster.c Modified: head/sys/kern/vfs_cluster.c ============================================================================== --- head/sys/kern/vfs_cluster.c Tue May 7 07:52:18 2013 (r250326) +++ head/sys/kern/vfs_cluster.c Tue May 7 08:16:21 2013 (r250327) @@ -76,6 +76,10 @@ static int read_max = 64; SYSCTL_INT(_vfs, OID_AUTO, read_max, CTLFLAG_RW, &read_max, 0, "Cluster read-ahead max block count"); +static int read_min = 1; +SYSCTL_INT(_vfs, OID_AUTO, read_min, CTLFLAG_RW, &read_min, 0, + "Cluster read min block count"); + /* Page expended to mark partially backed buffers */ extern vm_page_t bogus_page; @@ -166,6 +170,7 @@ cluster_read(struct vnode *vp, u_quad_t } else { off_t firstread = bp->b_offset; int nblks; + long minread; KASSERT(bp->b_offset != NOOFFSET, ("cluster_read: no buffer offset")); @@ -173,6 +178,13 @@ cluster_read(struct vnode *vp, u_quad_t ncontig = 0; /* + * Adjust totread if needed + */ + minread = read_min * size; + if (minread > totread) + totread = minread; + + /* * Compute the total number of blocks that we should read * synchronously. */