From owner-freebsd-current@FreeBSD.ORG Thu Mar 4 22:30:30 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B722116A4CE; Thu, 4 Mar 2004 22:30:30 -0800 (PST) Received: from mail.komquats.com (h24-108-145-252.gv.shawcable.net [24.108.145.252]) by mx1.FreeBSD.org (Postfix) with ESMTP id E2AE643D1F; Thu, 4 Mar 2004 22:30:29 -0800 (PST) (envelope-from Cy.Schubert@komquats.com) Received: from cwsys.cwsent.com (cwsys [10.1.1.1]) by mail.komquats.com (Postfix) with ESMTP id CF2155A82D; Thu, 4 Mar 2004 22:30:25 -0800 (PST) Received: from cwsys (localhost [127.0.0.1]) by cwsys.cwsent.com (8.12.10/8.12.8) with ESMTP id i256UM0f085624; Thu, 4 Mar 2004 22:30:22 -0800 (PST) (envelope-from Cy.Schubert@uumail.gov.bc.ca) Message-Id: <200403050630.i256UM0f085624@cwsys.cwsent.com> X-Mailer: exmh version 2.6.3 04/04/2003 with nmh-1.0.4 From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.komquats.com/ To: Don Lewis Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 04 Mar 2004 22:30:22 -0800 Sender: Cy.Schubert@komquats.com cc: freebsd-current@freebsd.org Subject: Re: sysctl spinning (was: Re: ps Causes Hard Hang) (fwd) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Cy Schubert List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Mar 2004 06:30:30 -0000 So far so good, the problem appears to be fixed. I'll leave it in production tonight. If I have any fallout tonight, I'll notify you tomorrow morning. Cheers, -- Cy Schubert http://www.komquats.com/ BC Government . FreeBSD UNIX Cy.Schubert@osg.gov.bc.ca . cy@FreeBSD.org http://www.gov.bc.ca/ . http://www.FreeBSD.org/ ------- Forwarded Message Date: Thu, 04 Mar 2004 16:21:29 -0800 From: Cy Schubert To: Don Lewis cc: freebsd-current@freebsd.org Subject: Re: sysctl spinning (was: Re: ps Causes Hard Hang) In message <200403042142.i24LgS7E005323@gw.catspoiler.org>, Don Lewis writes: > On 5 Mar, Bruce Evans wrote: > > On Thu, 4 Mar 2004, Don Lewis wrote: > > > >> I just checked the mlock() man page in the Single UNIX Specification > >> Version 3. Our mlock() implementation is broken. We should be > >> returning ENOMEM here, though this will result in some sort of user > >> visible sysctl breakage instead of a tight loop. > > > > POSIX is more authoritative. It says that ENOMEM may be returned if > > an implementation-defined limit would be exceeded, and that EAGAIN > > shall be returned if some or all of the memory could not be locked > > when the call was made. So it literally requires returning EAGAIN > > even when the limit would be exceeded, but it doesn't mean to require > > that. > > That's the same as SUSv3. > > I was pretty frazzled when I sent my previous message and was thinking > the test was something like: > if (atop(size) > vm_page_max_wired) > > The following patch is probably better. > > Index: sys/vm/vm_mmap.c > =================================================================== > RCS file: /home/ncvs/src/sys/vm/vm_mmap.c,v > retrieving revision 1.181 > diff -u -r1.181 vm_mmap.c > --- sys/vm/vm_mmap.c 1 Mar 2004 02:44:33 -0000 1.181 > +++ sys/vm/vm_mmap.c 4 Mar 2004 21:24:29 -0000 > @@ -923,8 +923,8 @@ > if (addr + size < addr) > return (EINVAL); > > - if (atop(size) + cnt.v_wire_count > vm_page_max_wired) > - return (EAGAIN); > + if (atop(size) > vm_page_max_wired) > + return (ENOMEM); > > PROC_LOCK(proc); > if (size + ptoa(pmap_wired_count(vm_map_pmap(&proc->p_vmspace->vm_map)) > ) > > @@ -933,6 +933,9 @@ > return (ENOMEM); > } > PROC_UNLOCK(proc); > + > + if (atop(size) + cnt.v_wire_count > vm_page_max_wired) > + return (EAGAIN); > > error = vm_map_wire(&proc->p_vmspace->vm_map, addr, > addr + size, VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES); > I'll give this a try tonight after my buildworld completes. I'll keep you posted. Cheers, - -- Cy Schubert http://www.komquats.com/ BC Government . FreeBSD UNIX Cy.Schubert@osg.gov.bc.ca . cy@FreeBSD.org http://www.gov.bc.ca/ . http://www.FreeBSD.org/ ------- End of Forwarded Message