From owner-freebsd-hackers@FreeBSD.ORG Tue Jan 20 15:49:10 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9361D106567E for ; Tue, 20 Jan 2009 15:49:10 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 700088FC2A for ; Tue, 20 Jan 2009 15:49:10 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 0BB9246B03; Tue, 20 Jan 2009 10:49:10 -0500 (EST) Date: Tue, 20 Jan 2009 15:49:09 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Danny Braniss In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org Subject: Re: ps acting weird? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jan 2009 15:49:11 -0000 On Tue, 20 Jan 2009, Danny Braniss wrote: > I just stumbled on this, ps(1) gives different info if the user is root or a > simple mortal: > > simple-mortal> ps p8130 > PID TT STAT TIME COMMAND > 8130 ?? Is 0:05.72 [java] > > root# ps p8130 > > PID TT STAT TIME COMMAND > 8130 ?? Is 0:05.73 /usr/local/diablo-jdk1.6.0/bin/java ... > > was this always like this? > btw, this is on 7.1-stable This happens when command lines are really long -- the kernel caches certain command line data when it's short (i.e., under a couple of hundred characters), but when it's long the only way to get it is to attach to the process's address space using debugging interfaces and read it from there. This requires ps(1) to have debugging rights for the target process, which will not always be true for simple mortal users, but will often be true for root. You can set the kern.ps_arg_cache_limit sysctl to increase the limit, which will take effect when the command line is next changed (typically, when the program is run again, but there are some programs that update their command lines to show status information, in which case it will be when they next update). This shows up particularly for Java command lines, which are often long. I would be careful not to tune it up too high as it will use up kernel memory/address space, but setting it to, say, 4k or 8k on modern systems shouldn't really be a problem, especially since most commands don't have long command lines. The problem this limit addresses is what happens when maxproc processes all set maximally-sized command lines. I.e., if your maxproc is 6,000, then fully filling the command line cache gives you 1.5MB of command line in kernel address space and memory - a lot, but very little compared to making the limit 4000 bytes, in which case it's more around 24MB. Robert N M Watson Computer Laboratory University of Cambridge > > danny > > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >