From owner-freebsd-questions@FreeBSD.ORG Sat Apr 12 20:52:41 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8E55106566C for ; Sat, 12 Apr 2008 20:52:41 +0000 (UTC) (envelope-from freebsd@sopwith.solgatos.com) Received: from parsely.rain.com (parsely.rain.com [199.26.172.196]) by mx1.freebsd.org (Postfix) with ESMTP id 2A0438FC14 for ; Sat, 12 Apr 2008 20:52:40 +0000 (UTC) (envelope-from freebsd@sopwith.solgatos.com) Received: from sopwith.solgatos.com (uucp@localhost) by parsely.rain.com (8.11.4/8.11.4) with UUCP id m3CKqec52736 for freebsd-questions@freebsd.org; Sat, 12 Apr 2008 13:52:40 -0700 (PDT) (envelope-from freebsd@sopwith.solgatos.com) Received: from localhost by sopwith.solgatos.com (8.8.8/6.24) id UAA06080; Sat, 12 Apr 2008 20:51:16 GMT Message-Id: <200804122051.UAA06080@sopwith.solgatos.com> To: freebsd-questions@freebsd.org In-reply-to: Your message of "Sat, 12 Apr 2008 21:54:40 +0300." <87ej9aaopb.fsf@kobe.laptop> Date: Sat, 12 Apr 2008 13:51:16 +0100 From: Dieter Subject: Re: 6.2 -> 7.0 now mlock(2) fails X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd@sopwith.solgatos.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Apr 2008 20:52:41 -0000 > > I never saw mlock(2) fail in 6.2 but with 7.0 I sometimes > > get mlock(2) failed: Resource temporarily unavailable. > > That's error EAGAIN: > > [EAGAIN] Locking the indicated range would exceed > either the system or per-process limit > for locked memory. > > You are hitting either the `vm.max_wired' limit, or the per-process > RLIMIT_MEMLOCK limit. > > > What changed and how do I fix it? > > It would be nice if you could run a test program that prints the value of > vm.max_wired and RLIMIT_MEMLOCK on 6.2 and then on 7.0. As an extra test, > it may be worth printing these values in the log of your application when > mlock(2) fails. vm.max_wired looks like a sysctl, but sysctl doesn't know about it. sysctl: unknown oid 'vm.max_wired' sysctl -a | grep -i wire | grep -vi firewire vm.stats.vm.v_wire_count: 89046 /usr/include/sys/resource.h:#define RLIMIT_MEMLOCK 6 /* locked-in-memory address space */ It doesn't always fail, just sometimes. It is trying to lock 172490752 bytes. There can be two processes wanting to do this at once. Seems to be the 2nd one that sometimes fails. with one process: vm.stats.vm.v_wire_count: 130992 (41946 more) with two processes (mlock failed): vm.stats.vm.v_wire_count: 131047 (55 more) killed both proceses: vm.stats.vm.v_wire_count: 88788