From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 13 09:47:22 2013 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DD8475B9 for ; Sun, 13 Oct 2013 09:47:22 +0000 (UTC) (envelope-from trtrmitya@gmail.com) Received: from mail-lb0-x234.google.com (mail-lb0-x234.google.com [IPv6:2a00:1450:4010:c04::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 662A82B46 for ; Sun, 13 Oct 2013 09:47:22 +0000 (UTC) Received: by mail-lb0-f180.google.com with SMTP id q8so4621355lbi.25 for ; Sun, 13 Oct 2013 02:47:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=CuW3ACdgg3w/tqMcU2CyFiygtw6xwTmy3yR4J/7ot78=; b=W+9eKBq8TmGONa8EcVdnIrp72qE7gy2g+qFI5VnPAmPJj/yuhkFBPm+GqNZvqP+5lA XX5nlpkM/217g27VMdpzF51RoBJRAG8ckQiSsz1evRbAuy5U0wk19DGjSWqNud+OxZPk IB27ELUblMAr20ANQconmr4Hvi28ZJ1MtJQCuXDjb8OHcmvq5InWZajCJPivZv+UbGdJ gyUSfhitJEJCg9qroqRIv+afB4V0aZ+MrQCwQUr+M6tnT1ihKts3+jrIkaHTMUtaTU7Y 2oWqqOC5TA3VshYWJrecWUJg8gWcLsvBjvpWhc+4omkUZlzYVcL+OzU3y7DB/+JrFMsE QeIg== X-Received: by 10.152.22.198 with SMTP id g6mr24925632laf.5.1381657640525; Sun, 13 Oct 2013 02:47:20 -0700 (PDT) Received: from [10.0.1.20] ([176.193.142.218]) by mx.google.com with ESMTPSA id b6sm53982846lae.0.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 13 Oct 2013 02:47:19 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: mmap() question From: Dmitry Sivachenko In-Reply-To: <20131012141440.GN41229@kib.kiev.ua> Date: Sun, 13 Oct 2013 13:47:17 +0400 Content-Transfer-Encoding: quoted-printable Message-Id: References: <95E0B821-BF9B-4EBF-A1E5-1DDCBB1C3D1B@gmail.com> <20131011051702.GE41229@kib.kiev.ua> <20131012095919.GI41229@kib.kiev.ua> <20131012141440.GN41229@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.1510) X-Mailman-Approved-At: Sun, 13 Oct 2013 11:45:56 +0000 Cc: "hackers@freebsd.org" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2013 09:47:22 -0000 On 12.10.2013, at 18:14, Konstantin Belousov = wrote: >>=20 >> First I tried with some swap space configured. The OS started to = swap out my process after it reached about 20GB which is also not what I = expected: what is the reason to swap out regions of read-only mmap()ed = files? Is it the expected behaviour? >>=20 > How did you concluded that the pages from your r/o mappings were paged = out ? > VM never does this. Only anonymous memory could be written to swap = file, > including the shadow pages for the writeable COW mappings. I suspect = that > you have another 20GB of something used on the machine meantime. >=20 Yes, sorry, I tried again with swap space configured and it is really = some other processes which are swapping out: sshd, other user's shells, etc. >>=20 >>>=20 >>> Below is the prototype patch, against HEAD. It is not applicable to >>> stable, please use HEAD kernel for test. >>=20 I tried your patch with stable/10 system and I can confirm that my = process is not killed anymore because of OOM.