From owner-freebsd-current@FreeBSD.ORG Wed Jun 18 14:25:39 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 65CA037B401 for ; Wed, 18 Jun 2003 14:25:39 -0700 (PDT) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8885943FBD for ; Wed, 18 Jun 2003 14:25:38 -0700 (PDT) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.9/8.12.9) with ESMTP id h5ILPaBE043721 for ; Wed, 18 Jun 2003 23:25:36 +0200 (CEST) (envelope-from phk@phk.freebsd.dk) To: current@freebsd.org From: Poul-Henning Kamp Date: Wed, 18 Jun 2003 23:25:36 +0200 Message-ID: <43720.1055971536@critter.freebsd.dk> Subject: Proof of concept patch for device rearrangement X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jun 2003 21:25:39 -0000 I have uploaded a proof of concept patch: http://phk.freebsd.dk/patch/fd_dev.patch WARNING: It is perfectly possibly that this patch eats your machine WARNING: destroys your disk and makes your corn-flakes soggy. WARNING: RUN AT YOUR OWN RISK! This patch basically shortcuts access from userland to devices directly from the file descriptor level through DEVFS to the device driver. So far there are no indications that we will not be moving in this direction pretty soon, but it may not be this exact way we do it, this is only a proof of concept at this point. I have only tested this patch lightly on a disk-less machine, I have not tried a lot of advanced stuff with it, and I have already noticed that syslogd seems to have an issue with it during startup (I just press ctrl-C for now). The patch is controlled by the sysctl "debug.phk" which can take the values 0 (disabled) or 1 (enabled). But the good news is that there is a measurable performance improvement: syv# sysctl debug.phk=0 debug.phk: 1 -> 0 syv# dd if=/dev/zero of=/dev/null count=100000 100000+0 records in 100000+0 records out 51200000 bytes transferred in 4.784862 secs (10700413 bytes/sec) syv# sysctl debug.phk=1 debug.phk: 0 -> 1 syv# dd if=/dev/zero of=/dev/null count=100000 100000+0 records in 100000+0 records out 51200000 bytes transferred in 2.211927 secs (23147238 bytes/sec) And with this code enabled, it is possible to go from userland to device driver without touching Giant underway. Comments and test-results are most welcome! -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.