vmalloc for zlib workspace

David Woodhouse dwmw2 at infradead.org
Mon May 26 05:53:56 EDT 2003


On Mon, 2003-05-26 at 10:40, Jörn Engel wrote:
> Actually, we could even go a bit further.  zlib itself could have a
> single workspace and a mutex.  Then we would add the following code to
> zlib_deflateInit2_():
> 	if (strm->workspace)
> 		mem = (deflate_workspace *) strm->workspace;
> 	else {
> 		down(&zlib_workspace_sem);
> 		mem = zlib_workspace;
> 	}
> 
> And this little feller to zlib_deflateEnd():
> 	up (&zlib_workspace_sem);
> 
> The same for inflate, of course, both using the same workspace and
> semaphore.
> 
> Now every subsystem using zlib can reuse the same workspace, jffs2
> anole would save one, a big fat system (TM) with jffs2, cramfs, ppp
> and additional patches would save quite a bit more.  And those systems
> do exist, no kidding.

Would be cute -- we need to ensure that it doesn't deadlock. In what
context does PPP do its decompression? I have a feeling it does it in BH
or softirq context, hence isn't allowed to attempt to obtain a
semaphore. cramfs and jffs2 could almost certainly share though.

-- 
dwmw2





More information about the linux-mtd mailing list