Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Mar 2005 21:23:27 -0600
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Jonathan Stewart <jonstew1983@yahoo.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Discrepancy between ps -i -o inblk and figuring numbers by hand
Message-ID:  <20050325032327.GE10908@dan.emsphone.com>
In-Reply-To: <20050325025804.73930.qmail@web50906.mail.yahoo.com>
References:  <20050325025804.73930.qmail@web50906.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Mar 24), Jonathan Stewart said:
> When I run the command ps -u -o inblock on a process reading a
> 262144000 byte file the highest block count I see is ~2010 but my
> filesystem block size is 16384 and 262144000/16384 is 16000 so it
> seems to be off by about a factor of 8. I even tried looking through
> the source code for the ps command but my C is not good enough for me
> to figure it out. Can someone explain or help me figure out what is
> going on please.

That ps column actually looks at the rusage value ru_inblk, which
doesn't count the number blocks read, but the number of times the
kernel did physical I/O on behalf of the process (how often the kernel
blocked doing a read).  The clustering code will fetch up to
sysctl(vfs.read_max) blocks at a time into disk cache, so reading
sequential files will increment ru_inblock (blocks_in_file/read_max)
times.  Raising vfs.read_max to 32 will greatly increase sequential
read performance on fast RAID arrays.

-- 
	Dan Nelson
	dnelson@allantgroup.com



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