Date: Tue, 14 Aug 2007 16:06:20 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Kostik Belousov <kostikbel@gmail.com> Cc: bugs@FreeBSD.org, fs@FreeBSD.org, Bruce Evans <brde@optusnet.com.au> Subject: Re: msdosfs not MPSAFE Message-ID: <20070814154812.J24186@besplex.bde.org> In-Reply-To: <20070810124153.GW2738@deviant.kiev.zoral.com.ua> References: <20070712084115.GA2200@deviant.kiev.zoral.com.ua> <20070712225324.F9515@besplex.bde.org> <20070712142127.GD2200@deviant.kiev.zoral.com.ua> <20070716195556.P12807@besplex.bde.org> <20070721063434.GI2200@deviant.kiev.zoral.com.ua> <20070721233613.Q3366@besplex.bde.org> <20070804075730.GP2738@deviant.kiev.zoral.com.ua> <20070808004001.O926@besplex.bde.org> <20070807170259.GJ2738@deviant.kiev.zoral.com.ua> <20070810133946.H769@besplex.bde.org> <20070810124153.GW2738@deviant.kiev.zoral.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 10 Aug 2007, Kostik Belousov wrote: > On Fri, Aug 10, 2007 at 01:54:48PM +1000, Bruce Evans wrote: >> I wrote yet another patch, with allocation on the stack so that no locking >> is required. This is simpler and doesn't require any new functions. >> Unfortunately, it is larger because it changes the interfaces for most >> functions. The interface changes are routine, so this is probably better. >> Note that 'struct dirent's are already allocated on the stack. This >> patch adds allocation of 'struct mbnambuf's which are slightly smaller >> (~256 bytes). I think this is just small enough for stack allocation. > > I agree that this is the best approach. The size of the on-stack > structure still make me worry, although ~270 bytes seems to be not too > large for 3-pages stack. Stack growth seems to be nowhere near a problem. With the extra ~270 bytes. ls -lR on i386 uses less than a 1-page stack (about 3.5K, including 0x270 bytes for the pcb). I think the maximum stack depth is attained when a debugger trap traps a fast interrupt interrupting a page fault in an i/o routine called from msdosfs_readdir(). Unlike in RELENG_4, nested interrupts can't occur, so a 1-page stack should be enough for everything on i386 (but of course isn't quite enough). I didn't try hard to attain the maximum depth, and just looked at where the stack got to after running a large ls -lR for a while. msdosfs_readdir() now allocates 0x2b0 bytes on the stack using "subl $0x2b0,%esp" and that is now the largest single allocation. This is without INVARIANTS etc. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070814154812.J24186>