linux/drivers/staging
Nitin Gupta c8f2f0db1d staging: zram: Fix handling of incompressible pages
Change 130f315a (staging: zram: remove special handle of uncompressed page)
introduced a bug in the handling of incompressible pages which resulted in
memory allocation failure for such pages.

When a page expands on compression, say from 4K to 4K+30, we were trying to
do zsmalloc(pool, 4K+30). However, the maximum size which zsmalloc can
allocate is PAGE_SIZE (for obvious reasons), so such allocation requests
always return failure (0).

For a page that has compressed size larger than the original size (this may
happen with already compressed or random data), there is no point storing
the compressed version as that would take more space and would also require
time for decompression when needed again. So, the fix is to store any page,
whose compressed size exceeds a threshold (max_zpage_size), as-it-is i.e.
without compression.  Memory required for storing this uncompressed page can
then be requested from zsmalloc which supports PAGE_SIZE sized allocations.

Lastly, the fix checks that we do not attempt to "decompress" the page which
we stored in the uncompressed form -- we just memcpy() out such pages.

Signed-off-by: Nitin Gupta <ngupta@vflare.org>
Reported-by: viechweg@gmail.com
Reported-by: paerley@gmail.com
Reported-by: wu.tommy@gmail.com
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22 13:45:19 -07:00
..
android Staging: android: binder: Allow using highmem for binder buffers 2012-10-22 13:23:19 -07:00
asus_oled
bcm Staging: bcm: Remove typedef for _stCPacketClassificationRuleSI and call directly. 2012-09-26 09:31:52 -07:00
ccg Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
ced1401
comedi staging: comedi: ni_labpc: fix possible NULL deref during detach 2012-10-22 11:46:35 -07:00
cptm1217
crystalhd
csr
cxt1e1
dgrp userns: Fix build of drivers/staging/dgrp 2012-10-03 09:52:08 -07:00
echo
et131x Staging tree update for 3.7-rc1 2012-10-01 12:11:39 -07:00
frontier
ft1000
gdm72xx Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2012-10-02 13:38:27 -07:00
iio staging:iio:adis16400: Fixup adis16336 temp channel attributes 2012-10-19 16:23:34 +01:00
imx-drm
ipack TTY merge for 3.7-rc1 2012-10-01 12:26:52 -07:00
keucr USB merge for 3.7-rc1 2012-10-01 13:23:01 -07:00
line6
media
net
nvec Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
octeon
olpc_dcon
omap-thermal Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux into thermal 2012-10-09 01:35:52 -04:00
omapdrm fbdev updates for 3.7 2012-10-12 10:21:02 +09:00
ozwpan
panel
phison
quickstart
ramster
rtl8187se
rtl8192e Staging tree update for 3.7-rc1 2012-10-01 12:11:39 -07:00
rtl8192u
rtl8712 staging: r8712u: Do not queue cloned skb 2012-09-26 13:05:50 -07:00
rts5139
rts_pstor
sbe-2t3e3
sep
serqt_usb2 USB merge for 3.7-rc1 2012-10-01 13:23:01 -07:00
silicom
slicoss
sm7xxfb
speakup TTY merge for 3.7-rc1 2012-10-01 12:26:52 -07:00
ste_rmi4
telephony
tidspbridge mm: kill vma flag VM_RESERVED and mm->reserved_vm counter 2012-10-09 16:22:19 +09:00
usbip USB merge for 3.7-rc1 2012-10-01 13:23:01 -07:00
vme
vt6655
vt6656
winbond Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2012-10-02 13:38:27 -07:00
wlags49_h2
wlags49_h25
wlan-ng
xgifb
zcache
zram staging: zram: Fix handling of incompressible pages 2012-10-22 13:45:19 -07:00
zsmalloc
Kconfig TTY merge for 3.7-rc1 2012-10-01 12:26:52 -07:00
Makefile TTY merge for 3.7-rc1 2012-10-01 12:26:52 -07:00
staging.c