From nobody@FreeBSD.org  Fri Feb  9 09:53:29 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id B50EB16A400
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  9 Feb 2007 09:53:29 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (groups.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 8DCA413C4A5
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  9 Feb 2007 09:53:29 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l199rTB8005169
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 9 Feb 2007 09:53:29 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l199rTaf005168;
	Fri, 9 Feb 2007 09:53:29 GMT
	(envelope-from nobody)
Message-Id: <200702090953.l199rTaf005168@www.freebsd.org>
Date: Fri, 9 Feb 2007 09:53:29 GMT
From: Jonathan Hammond<jhammond@sky.net.uk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: High CPU use on directories containing files with multiple UIDs
X-Send-Pr-Version: www-3.0

>Number:         108961
>Category:       bin
>Synopsis:       ls(1) High CPU use on directories containing files with multiple UIDs [regression]
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    vwe
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 09 10:00:29 GMT 2007
>Closed-Date:    Tue Jan 04 14:22:07 UTC 2011
>Last-Modified:  Tue Jan 04 14:22:07 UTC 2011
>Originator:     Jonathan Hammond
>Release:        5.1 Release (affects 5.1 up to latest 6)
>Organization:
>Environment:
FreeBSD test.skynet.co.uk 5.1-RELEASE-p18 FreeBSD 5.1-RELEASE-p18 #0: Thu Feb  8 17:06:18 GMT 2007     root@test.skynet.co.uk:/usr/src/sys/i386/compile/TEST  i386
>Description:
We have noticed an issue where multiple files exist in a directory with
different UIDs.  We are running a sendmail mailserver , and all user
mail gets written to /var/mail directory as is usual, each mailbox file
with the UID of the user.  We have moved the server to FreeBSD 6, and
straightaway noticed much higher CPU load while accessing that
directory; a simple "ls -l" command would take over 10 seconds to
complete on the new server where before it took less than a second.

After replicating the problem on a test server, we were able to confirm
that the issue only occured when there were multiple files owned by
multiple UIDs in a directory, a thousand files of the same UID would
take less than a second to list.  

After performing tests on multiple versions of FreeBSD we have narrowed
it down to some change that occured between 5.0 and 5.1 and is still
present in the latest 6-BRANCH RELEASE.  We created a
test script that creates 1000 users and creates a file owned by each of
them in one directory.  An ls -l command is then performed and timed. 
Here are the results with both FreeBSD 5.0 and 5.1

FreeBSD-5.0 RELEASE

Creating 1000 users
User: 01000

Doing a ls -l in /tmp/ownership-slowdown for 1000 users took ...
        0.08s real              0.03s user              0.04s sys
Chowning all files in /tmp/ownership-slowdown to nobody
Doing a ls -l again in /tmp/ownership-slowdown for 1000 users took ...
        0.03s real              0.00s user              0.02s sys


FreeBSD-5.1 RELEASE

Creating 1000 users
User: 01000

Doing a ls -l in /tmp/ownership-slowdown for 1000 users took ...
        12.43s real             1.57s user              10.79s sys
Chowning all files in /tmp/ownership-slowdown to nobody
Doing a ls -l again in /tmp/ownership-slowdown for 1000 users took ...
        0.03s real              0.02s user              0.00s sys



>How-To-Repeat:
Create multiple files owned by multiple users in a single directory.  time
an ls -l on this directory. Test script can be provided.
>Fix:

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue Feb 13 00:49:42 UTC 2007 
Responsible-Changed-Why:  
This does not sound i386-specific. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=108961 
State-Changed-From-To: open->suspended 
State-Changed-By: vwe 
State-Changed-When: Tue May 20 21:48:47 UTC 2008 
State-Changed-Why:  

there's another report for the same issue bin/112613 which contains more 
information - suspending this until a solution has been found 


Responsible-Changed-From-To: freebsd-bugs->vwe 
Responsible-Changed-By: vwe 
Responsible-Changed-When: Tue May 20 21:48:47 UTC 2008 
Responsible-Changed-Why:  

track for DUP issue of bin/112613 

http://www.freebsd.org/cgi/query-pr.cgi?pr=108961 
State-Changed-From-To: suspended->closed 
State-Changed-By: arundel 
State-Changed-When: Tue Jan 4 14:20:12 UTC 2011 
State-Changed-Why:  
Since this PR is a duplicate of 112613 which has much more details about the 
issue: close this PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=108961 
>Unformatted:
