[PATCH RFC] 1/2 central workspace for zlib
matsunaga
matsunaga_kazuhisa at yahoo.co.jp
Mon Jun 2 11:15:56 EDT 2003
> The following creates a central workspace per cpu for the zlib. The
> original idea was to save memory for embedded, but this should also
> improve performance for smp.
Hi
Thank you for the patch.
It definitely reduces resources and improve multiple CPU scalability.
But I still would like to stick to performance.
(Though I haven't evaluated the performance yet...)
So far I think MTD is used mostly on Embedded device,
in which single CPU which is not so powerful is used.
How is the following code (it is ugly though)?
static void default_workspace[WSIZE];
<snip>
size = MAX(sizeof(struct inflate_workspace),
sizeof(struct deflate_workspace));
if(WSIZE < size)
BUG();
zlib_workspace[0] = default_workspace;
for (i=1; i<smp_num_cpus; i++) {
zlib_workspace[i] = vmalloc(size);
if (!zlib_workspace[i]) {
zlib_exit();
return -ENOMEM;
}
}
P.S.
There is another vmalloc in mtdblock_open()...;-)
More information about the linux-mtd
mailing list