From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 3 00:29:23 2015 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 500DAF3B; Tue, 3 Mar 2015 00:29:23 +0000 (UTC) Received: from mail-la0-x234.google.com (mail-la0-x234.google.com [IPv6:2a00:1450:4010:c03::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC764F88; Tue, 3 Mar 2015 00:29:22 +0000 (UTC) Received: by labgd6 with SMTP id gd6so34125106lab.7; Mon, 02 Mar 2015 16:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:reply-to:to:cc:references:in-reply-to:subject:date :mime-version:content-type:content-transfer-encoding:thread-index :content-language; bh=6SykWdpm0toZoYoiK2+k40BHwkKa1U7aMacc3JK3tH4=; b=nnP/cJ61crpHk+UC5Rr2umeDqULeS7yawehR0z0WLwBcJzJtCckwmgnTQsc1HuJ4+n Dgf95c4GIxlju7ntIVBwKTV5S6KCMgSKYhPDL2tT5HG576cUKLsYXxPDZXYPufJ+Obrj 8UVHWCfAZrj27qNTgpKs/iyt7FF4kVVWPiRCbn+FGiD1/R2VvSasH7jwXqEM16rwfh0F lhv0zjuCpbwff+BgHSCeprDv2III8EyoNLuvY8CjJHJKnXKVDB9T5xssbuvsFS4kZIUC ncZp3T7/LAOLJ38C78Pza/r2LCFQU5Un/tdWzO+bD2+zNUL5IrMo4LSb0Ju+/xAP+XLT W2xg== X-Received: by 10.112.134.106 with SMTP id pj10mr27320007lbb.58.1425342560934; Mon, 02 Mar 2015 16:29:20 -0800 (PST) Received: from w7x64wksv ([2001:470:1f15:8e:b464:a058:953b:d415]) by mx.google.com with ESMTPSA id j7sm2836708lbm.9.2015.03.02.16.29.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Mar 2015 16:29:19 -0800 (PST) Message-ID: <54f5005f.272d700a.09bb.ffffce64@mx.google.com> X-Google-Original-Message-ID: <00d401d05549$16b5ef60$4421ce20$@IM@gmail.com> From: rozhuk.im@gmail.com X-Google-Original-From: Reply-To: To: "'Dmitry Sivachenko'" , References: <95E0B821-BF9B-4EBF-A1E5-1DDCBB1C3D1B@gmail.com> In-Reply-To: Subject: RE: mmap() question Date: Tue, 3 Mar 2015 03:29:17 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdBJEz2T/+8KVIDUQD+NFnA01M0YxgMNcgkQ Content-Language: ru Cc: 'Konstantin Belousov' X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Mar 2015 00:29:23 -0000 > > I have a program which mmap()s a lot of large files (total size more > that RAM and I have no swap), but it needs only small parts of that > files at a time. > > > > My understanding is that when using mmap when I access some memory > region OS reads the relevant portion of that file from disk and caches > the result in memory. If there is no free memory, OS will purge > previously read part of mmap'ed file to free memory for the new chunk. > > > > But this is not the case. I use the following simple program which > gets list of files as command line arguments, mmap()s them all and then > selects random file and random 1K parts of that file and computes a XOR > of bytes from that region. > > After some time the program dies: > > pid 63251 (a.out), uid 1232, was killed: out of swap space My PR with same: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195882 "this is not bug" - say some devs.