From owner-freebsd-lite2 Thu Oct 10 00:41:23 1996 Return-Path: owner-lite2 Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id AAA26446 for lite2-outgoing; Thu, 10 Oct 1996 00:41:23 -0700 (PDT) Received: from who.cdrom.com (who.cdrom.com [204.216.27.3]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id AAA26441 for ; Thu, 10 Oct 1996 00:41:21 -0700 (PDT) Received: from uno.sat.t.u-tokyo.ac.jp (uno.sat.t.u-tokyo.ac.jp [133.11.70.160]) by who.cdrom.com (8.7.5/8.6.11) with ESMTP id AAA11751 for ; Thu, 10 Oct 1996 00:41:16 -0700 (PDT) Received: by uno.sat.t.u-tokyo.ac.jp (8.7.3+2.6Wbeta5/8.7.3) with ESMTP id QAA01521; Thu, 10 Oct 1996 16:38:45 +0900 (JST) To: Doug Rabson Cc: henrich@crh.cl.msu.edu, lite2@freebsd.org Subject: Re: Delayed write patch X-Mailer: Mew version 1.06 on Emacs 19.28.1, Mule 2.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Date: Thu, 10 Oct 1996 16:38:44 +0900 Message-ID: <1519.844933124@sat.t.u-tokyo.ac.jp> From: Hidetoshi Shimokawa Sender: owner-lite2@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi, I got the problem! dfr> If you change nfs_maxdelwri to zero using gdb or ddb, what write dfr> performance do you see? That ought to be the same as the nfs_dwrite==0 dfr> case. I can't figure out why the other iods should get locked out. Are dfr> you sure that all the reqs are made by the same iod? Yes, the problem was caused by.. 1) the process processing DELWRT doesn't sleep. (except when waiting packet, but at this point other iods are locked out) 2) normal iod will tsleep after processing one buffer. 3) if CPU is fast enough DELWRT process can get rcvlock after rcvunlock without process switching. (beause rcvunlock is sleep for waiting packet, it has enough time until switching) - results 1) -current (bwrite=1) 2) bwrite=0 3) bwrite=1 + my patch client server ---------------------------------- A. 100M FreeBSD ------ Solaris 2.5 --- Fast Disk Pentium Pro Sun Ultra 1) 300KB/s write 2) 800KB/s write 3) 600KB/s write B. 10M FreeBSD ------- FreeBSD ------ Slow Disk DX4 75MHz Pentium 166MHz 1) 120KB/s write 2) 140KB/s write 3) 170KB/s write I think it depends on an environment which is better bwrite=0 or bwrite=1 and it should be able to be chosen by sysctl. The following patch should fix the locking problem. (I don't know which number I should return as error code, please fix it.) I think you should remove maxdelwri patch. I would like to hear other results. *** nfs_socket.c.orig Sat Jul 27 07:08:43 1996 --- nfs_socket.c Thu Oct 10 15:37:56 1996 *************** *** 682,695 **** --- 682,700 ---- * Also necessary for connection based protocols to avoid * race conditions during a reconnect. */ + #define ALREADY_RECEIVED 1 error = nfs_rcvlock(myrep); + if (error == ALREADY_RECEIVED) + return (0); if (error) return (error); + #if 0 /* Already received, bye bye */ if (myrep->r_mrep != NULL) { nfs_rcvunlock(&nmp->nm_flag); return (0); } + #endif /* * Get the next Rpc reply off the socket */ *************** *** 1494,1499 **** --- 1499,1506 ---- *flagp |= NFSMNT_WANTRCV; (void) tsleep((caddr_t)flagp, slpflag | (PZERO - 1), "nfsrcvlk", slptimeo); + if (rep->r_mrep != NULL) + return(ALREADY_RECEIVED); if (slpflag == PCATCH) { slpflag = 0; slptimeo = 2 * hz; /\ Hidetoshi Shimokawa \/ simokawa@sat.t.u-tokyo.ac.jp PGP public key: finger -l simokawa@sat.t.u-tokyo.ac.jp