From owner-cvs-all@FreeBSD.ORG Mon Jan 23 19:58:25 2006 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9D58416A420; Mon, 23 Jan 2006 19:58:25 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.FreeBSD.org (Postfix) with ESMTP id 518EB44219; Mon, 23 Jan 2006 19:58:24 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.5b3) with ESMTP id 6784139 for multiple; Mon, 23 Jan 2006 14:59:32 -0500 Received: from localhost (john@localhost [127.0.0.1]) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id k0NJwLGX002949; Mon, 23 Jan 2006 14:58:22 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Stephan Uphoff Date: Mon, 23 Jan 2006 14:55:47 -0500 User-Agent: KMail/1.9.1 References: <200601231915.k0NJFDE7080866@repoman.freebsd.org> In-Reply-To: <200601231915.k0NJFDE7080866@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200601231455.49892.jhb@freebsd.org> X-Virus-Scanned: ClamAV 0.87.1/1247/Sat Jan 21 05:24:51 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=4.2 tests=ALL_TRUSTED autolearn=failed version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx X-Server: High Performance Mail Server - http://surgemail.com r=1653887525 Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/kern kern_exit.c kern_resource.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2006 19:58:25 -0000 On Monday 23 January 2006 14:15, Stephan Uphoff wrote: > ups 2006-01-23 19:15:13 UTC > > FreeBSD src repository > > Modified files: > sys/kern kern_exit.c kern_resource.c > Log: > Hopefully fix the "calcru: runtime went backwards from ..." problem by > keeping the resource values locked (where needed) while we use them > for calculations. > > MFC after: 3 days Why expand the locking in calcru()? calcru1() is working with a static rusage_ext on calcru()'s stack, not the one for process p that is generated while sched_lock is held. The 'p' for calcru1() is only used for printfs, no actual data is taken from p. I think the ruadd() change might be the only fix needed, though I think the updating of p->p_stats->p_ru.ru_nvcsw and p->p_ru needs to be deferred as well since the race you seem to be fixing is the case where exit1() is preempted, but with the current change you'd still have stale data in p->p_ru (since it is a copy of p->p_stats->p_ru, not a pointer) unless you move the updating of p->p_ru down to just before the ruadd() as it was previously. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org