From owner-freebsd-arch Tue Jan 21 10:52:11 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 1F15137B401; Tue, 21 Jan 2003 10:52:09 -0800 (PST) Received: from canning.wemm.org (canning.wemm.org [192.203.228.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD42843E4A; Tue, 21 Jan 2003 10:52:08 -0800 (PST) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by canning.wemm.org (Postfix) with ESMTP id A82EB2A7EA; Tue, 21 Jan 2003 10:52:08 -0800 (PST) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Robert Watson Cc: phk@freebsd.org, Matthew Dillon , "Alan L. Cox" , arch@freebsd.org Subject: Re: getsysfd() patch #1 (Re: Virtual memory question) In-Reply-To: Date: Tue, 21 Jan 2003 10:52:08 -0800 From: Peter Wemm Message-Id: <20030121185208.A82EB2A7EA@canning.wemm.org> 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 Robert Watson wrote: > > On Tue, 21 Jan 2003 phk@freebsd.org wrote: > > > In message , Robe > > rt Watson writes: > > > > > >Ok, so lemme revise my thinking. Could we take this patch, rename the API > > >from getsysfd(various things) to memfd(size), and simply provide anonymous > > >swap-backed memory only? > > > > The traditional design would be: > > > > fd = open("/dev/shmem", ...); > > ptr = mmap(..., fd, ...) > > Well, it struck me the three implementations that came to mind would be: > > (1) shmfs. > > mount -t shmfs foo /shmfs > > Handle the implementation using vnodes and DTYPE_VNODE Umm.... > (2) /dev/shm > > Handle the implementation using cloning devices and device pager > magic. > > (3) DTYPE_MEMFD > > Handle the implementation using a special file descriptor type > creating using a special creation primitive (similar to kqueue, > pipe, etc). > > Of the three, (3) appears to be simplist to implement, (1) the most > complicated. I'm probably not qualified to comment on (2), but have to > say that (3) would be the easiest to stick in MAC magic for :-). But only > if (3) completely avoids the kitchensinkfd() approach. From the API > perspective, you could easily hide any of these behind a memfd() library > call. (2) and (3) are not all that different, except that (2) requires another hack in the mmap syscall code to recognize and magically convert. (3) is cleaner but requires a more code to add the DTYPE_xxxFD stuff and affects more places in the kernel where we switch() on fd types. I personally prefer (3) - which is what Matt has implemented, but could live with (2). (1) is way more complicated than I want to think about especially if it goes near vnodes. What I'm objecting to though is the syscall that is wrapped around (3) in Matt's patch. I'd rather use a seperate syscall for any new uses of the system (timers, whatever) rather than try and come up with a future proof uber-syscall. What if down the track we discover that we could do something nifty and reuse part of this, but we need two configuration args to the syscall.. What then? getsysfd2(....)? I'd rather that we just create the syscalls for the specific purpose that they're needed for. Cheers, -Peter -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message