Skip to content

Commit

Permalink
Squashfs: Use vmalloc rather than kmalloc for zlib workspace
Browse files Browse the repository at this point in the history
Bugzilla bug 31422 reports occasional "page allocation failure. order:4"
at Squashfs mount time.  Fix this by making zlib workspace allocation
use vmalloc rather than kmalloc.

Reported-by: Mehmet Giritli <[email protected]>
Signed-off-by: Phillip Lougher <[email protected]>
  • Loading branch information
Phillip Lougher committed Mar 22, 2011
1 parent 44cff8a commit 117a91e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/squashfs/zlib_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/buffer_head.h>
#include <linux/slab.h>
#include <linux/zlib.h>
#include <linux/vmalloc.h>

#include "squashfs_fs.h"
#include "squashfs_fs_sb.h"
Expand All @@ -37,8 +38,7 @@ static void *zlib_init(struct squashfs_sb_info *dummy, void *buff, int len)
z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL);
if (stream == NULL)
goto failed;
stream->workspace = kmalloc(zlib_inflate_workspacesize(),
GFP_KERNEL);
stream->workspace = vmalloc(zlib_inflate_workspacesize());
if (stream->workspace == NULL)
goto failed;

Expand All @@ -56,7 +56,7 @@ static void zlib_free(void *strm)
z_stream *stream = strm;

if (stream)
kfree(stream->workspace);
vfree(stream->workspace);
kfree(stream);
}

Expand Down

0 comments on commit 117a91e

Please sign in to comment.