zsmalloc: record handle in page->private for huge object
authorMinchan Kim <[email protected]>
Wed, 15 Apr 2015 23:15:39 +0000 (16:15 -0700)
committerLinus Torvalds <[email protected]>
Wed, 15 Apr 2015 23:35:21 +0000 (16:35 -0700)
commit7b60a68529b0d827d26ea3426c2addd071bff789
tree5d812c66da45b12b2ae005b7db950596751e3ba5
parent4e3ba87845420e0bfa21e6c4f7f81897aed38f8c
zsmalloc: record handle in page->private for huge object

We store handle on header of each allocated object so it increases the
size of each object by sizeof(unsigned long).

If zram stores 4096 bytes to zsmalloc(ie, bad compression), zsmalloc needs
4104B-class to add handle.

However, 4104B-class has 1-pages_per_zspage so wasted size by internal
fragment is 8192 - 4104, which is terrible.

So this patch records the handle in page->private on such huge object(ie,
pages_per_zspage == 1 && maxobj_per_zspage == 1) instead of header of each
object so we could use 4096B-class, not 4104B-class.

Signed-off-by: Minchan Kim <[email protected]>
Cc: Juneho Choi <[email protected]>
Cc: Gunho Lee <[email protected]>
Cc: Luigi Semenzato <[email protected]>
Cc: Dan Streetman <[email protected]>
Cc: Seth Jennings <[email protected]>
Cc: Nitin Gupta <[email protected]>
Cc: Jerome Marchand <[email protected]>
Cc: Sergey Senozhatsky <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: Mel Gorman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/zsmalloc.c