From owner-freebsd-hackers@FreeBSD.ORG Sat Oct 12 12:04:35 2013 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 ESMTP id 676D587F for ; Sat, 12 Oct 2013 12:04:35 +0000 (UTC) (envelope-from trtrmitya@gmail.com) Received: from mail-la0-x234.google.com (mail-la0-x234.google.com [IPv6:2a00:1450:4010:c03::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E5CBE2A4C for ; Sat, 12 Oct 2013 12:04:34 +0000 (UTC) Received: by mail-la0-f52.google.com with SMTP id ev20so4158406lab.25 for ; Sat, 12 Oct 2013 05:04:32 -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=rK6Lc9bVb7nCcxRRPBYBk+cQ4uvBf84lAT0dFAMSxdA=; b=HcMiVRpH4D5L6MhsESe6jo2XNK646ovSmLdDfNWFyczfzkRjkdc6rHQZ6Q6eA5DyzI yeWsv4IYnPSkuZza8lCwgfz/qsGu0udlpAMkxCy0PEUXNQm6Omafc2vMQlZO7ogM67Rl Cg/+0DdCxUnJ3u4sKbi2BSyJXM3YcKy9NxRxXDrbDsuOPdQC1n2wuphq6Ll66tFuco0D +iIMvbnrij3Rbc9re5k4ev+SUR5syzzqoAdjKX+3NlXAQv/SFTHf+IxCPSCgUVLuc3Uf mdDtDQsYWaw/qhnht7QhGm71tJmO0ks+eIuvPEV6T8j4R5+JkhtwdTt2JuUsKtesHAAf XUGQ== X-Received: by 10.112.172.137 with SMTP id bc9mr21149298lbc.21.1381579472921; Sat, 12 Oct 2013 05:04:32 -0700 (PDT) Received: from [10.0.1.20] ([176.193.142.218]) by mx.google.com with ESMTPSA id pw4sm36690769lbb.9.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 12 Oct 2013 05:04:31 -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: <20131012095919.GI41229@kib.kiev.ua> Date: Sat, 12 Oct 2013 16:04:31 +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> To: Konstantin Belousov X-Mailer: Apple Mail (2.1510) X-Mailman-Approved-At: Sat, 12 Oct 2013 12:15:09 +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: Sat, 12 Oct 2013 12:04:35 -0000 On 12.10.2013, at 13:59, Konstantin Belousov = wrote: >=20 > I was not able to reproduce the situation locally. I even tried to = start > a lot of threads accessing the mapped regions, to try to outrun the > pagedaemon. The user threads sleep on the disk read, while pagedaemon > has a lot of time to rebalance the queues. It might be a case when SSD > indeed makes a difference. >=20 With ordinary SATA drive it will take hours just to read 20GB of data = from disk because of random access, it will do a lot of seeks and = reading speed will be extremely low. SSD dramatically improves reading speed. > Still, I see how this situation could appear. The code, which triggers > OOM, never fires if there is a free space in the swapfile, so the > absense of swap is neccessary condition to trigger the bug. Next, OOM > calculation does not account for a possibility that almost all pages = on > the queues can be reused. It just fires if free pages depleted too = much > or free target cannot be reached. 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 > Below is the prototype patch, against HEAD. It is not applicable to > stable, please use HEAD kernel for test. Thanks, I will test the patch soon and report the results.=