From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 23 09:52:16 2014 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 86FBC848 for ; Mon, 23 Jun 2014 09:52:16 +0000 (UTC) Received: from mail-lb0-x229.google.com (mail-lb0-x229.google.com [IPv6:2a00:1450:4010:c04::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 11894247D for ; Mon, 23 Jun 2014 09:52:15 +0000 (UTC) Received: by mail-lb0-f169.google.com with SMTP id l4so4194193lbv.28 for ; Mon, 23 Jun 2014 02:52:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=3KubYOnKGDd57xsjN9BBd1LbZKILlimCQd9QFGfpqjg=; b=AkD9nDKZT+UYBLYJK6P538bnu+LAFv4M30dSfGSTj4dZldlCwr8sbFwbes7AqSZx6q JHmtU4gms7m05UEVUUOj/rx+RsSc0jbVx/Dol4HvDbtH+6k73DBkOU4vBnXoNe6iXy7a Ene9tfGJCIVoH5GWsj0CyzniKvlL9GUJgGNrAo+TWPNmR7WUVXaiQYTY64+ALslDEB0H bg1Co9MBBqoUX2PBZkO4poAHNKdmErtPKIITuEtoWnMt9otVxiASTF8kG8xW/jCN9FOg MXuWVDSR1IYc7EL4cnzZq94iaasxQCEWMqRuv01pzwlYClE3+8rBhuZUK9ONK0suFNUO ctLw== X-Received: by 10.152.3.41 with SMTP id 9mr638153laz.86.1403517133772; Mon, 23 Jun 2014 02:52:13 -0700 (PDT) Received: from ?IPv6:2a02:6b8::408:2957:6195:671c:5d00? ([2a02:6b8:0:408:2957:6195:671c:5d00]) by mx.google.com with ESMTPSA id pp8sm2538959lbb.4.2014.06.23.02.52.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 02:52:11 -0700 (PDT) From: Dmitry Sivachenko Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: mlock() and vm_max_wired Message-Id: Date: Mon, 23 Jun 2014 13:52:09 +0400 To: hackers@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) X-Mailer: Apple Mail (2.1878.2) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jun 2014 09:52:16 -0000 Hello! I am using FreeBSD-10/stable and have a problem with mlock(). I have 256GB of memory and a program which does mmap+mlock on a number = of data files. It can process one file several times (so it does mmap() = + mlock() on the same file more than once). I set vm.max_wired=3D67108864 (67108864 * 4k =3D 256GB), so it is = allowed to mlock() the whole RAM. The total size of all files is about 180GB. The program fails with mlock: Resource temporarily unavailable error. If I increase vm.max_wired even more, the program works fine and after = it starts top(1) shows about 186GB of Wired memory. Why does it fail with vm.max_wired=3D67108864? Is it a bug or am I = missing something? Thanks.=