From owner-freebsd-arch Wed Jan 22 14:38: 5 2003 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4D64E37B401 for ; Wed, 22 Jan 2003 14:38:04 -0800 (PST) Received: from mail.chesapeake.net (chesapeake.net [205.130.220.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6CBDB43F18 for ; Wed, 22 Jan 2003 14:38:03 -0800 (PST) (envelope-from jroberson@chesapeake.net) Received: from localhost (jroberson@localhost) by mail.chesapeake.net (8.11.6/8.11.6) with ESMTP id h0MMbvj25082; Wed, 22 Jan 2003 17:37:58 -0500 (EST) (envelope-from jroberson@chesapeake.net) Date: Wed, 22 Jan 2003 17:37:57 -0500 (EST) From: Jeff Roberson To: Matthew Dillon Cc: Garrett Wollman , , Subject: Re: getsysfd() patch #1 (Re: Virtual memory question) In-Reply-To: <200301222144.h0MLifiC009829@apollo.backplane.com> Message-ID: <20030122173229.D46974-100000@mail.chesapeake.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 22 Jan 2003, Matthew Dillon wrote: > You guys are talking apples and oranges here. shm_open() is a libc > call, not a system call. getmemfd() or equivalent is a system call > and performs a function that no other system call can duplicate. Until > we fix our VFS layering system to provide a call vector for file > descriptors, the descriptors returned by the two APIs are not going to > be compatible. e.g. you can call ftruncate() on an shm_open() > descriptor (because it is essentially just a file descriptor), but you > cannot call ftruncate() on a getmemfd() descriptor. I think the argument is for fixing the implementation of shm_open() such that it supports this feature and move it into kernel space. Such that if you use a key preceded by a '/' it will use the filesystem as the namespace and otherwise it will be local and swap backed. Is there something wrong with this approach? > > The primary problem with using shm_open() in its current implementation > is the fact that the anonymous memory associated with the descriptor > is file-backed when what we really want is swap-backed anonymous memory. > file-backed memory has serious repercussions that swap backed memory does > not. The two most serious repercussions are (A) it will eat space in > the filesystem and (B) if you do not pre-zero the space, any pageout > activity will (due to its randomness) create an extremely inefficient, > highly fragmented file. Additionally, the most important madvise() > function, MADV_FREE, does not work on file-backed memory. > A doesn't sound so serious to me, but ok. I think I have an idea of why B happens but can you be more specific? Why does MADV_FREE not work with file backed memory? I'm not arguing against the ability to mmap an object that lives in swap. I'd just like to see if there are improvements that we could make to the vm to handle the mmap file case. Cheers, Jeff To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message