vmalloc for zlib workspace

Jörn Engel joern at wohnheim.fh-wedel.de
Thu May 22 15:57:08 EDT 2003


On Fri, 23 May 2003 00:40:37 +0900, matsunaga wrote:
> 
> In the jffs2_zlib_init() function of fs/jffs2/comr_zlib.c. 
> workspace is aquired by vmalloc.
> 
> But it could be allocated by static variable, like;
> 
> static char dbuf[WORKSPACESIZE];
> 
> int __init jffs2_zlib_init(void)
> {
>         def_strm.workspace = dbuf;
> 
> Care should be taken as to the workspace size, but it is old refined library and it would hardly be changed.
> It would reduce TLB load and improve performance (a little).

Great idea!

How about:

static void deflate_workspace[WORKSPACESIZE];
static void inflate_workspace[WORKSPACESIZE];

int __init jffs2_zlib_init(void)
{
	if (WORKSPACESIZE < zlib_deflate_workspacesize())
		BUG();
	if (WORKSPACESIZE < zlib_inflate_workspacesize())
		BUG();
	return 0;
}

In a second patch, it would be possible to fold those two workspaces
into one and save a little memory as well.

Jörn

-- 
They laughed at Galileo.  They laughed at Copernicus.  They laughed at
Columbus. But remember, they also laughed at Bozo the Clown.
-- unknown



More information about the linux-mtd mailing list