android_kernel_sony_msm8994/mm
Mahendran Ganesh c9c6d48f8b UPSTREAM: mm/zsmalloc: support allocating obj with size of ZS_MAX_ALLOC_SIZE
(cherry-pick from commit 40f9fb8cffc6a20ae269e3b43dfba7a4f65d7f50)

I sent a patch [1] for unnecessary check in zsmalloc.  And Minchan Kim
found zsmalloc even does not support allocating an obj with the size of
ZS_MAX_ALLOC_SIZE in some situations.

For example:
   In system with 64KB PAGE_SIZE and 32 bit of physical addr. Then:
   ZS_MIN_ALLOC_SIZE is 32 bytes which is calculated by:
      MAX(32, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS))
   ZS_MAX_ALLOC_SIZE is 64KB(in current code, is PAGE_SIZE)
   ZS_SIZE_CLASS_DELTA is 256 bytes
   So, ZS_SIZE_CLASSES = (ZS_MAX_ALLOC_SIZE - ZS_MIN_ALLOC_SIZE) /
                          ZS_SIZE_CLASS_DELTA + 1
                       = 256

   In zs_create_pool(), the max size obj which can be allocated will be:
      ZS_MIN_ALLOC_SIZE + i * ZS_SIZE_CLASS_DELTA = 32 + 255*256 = 65312

   We can see that 65312 < 65536 (ZS_MAX_ALLOC_SIZE). So we can NOT
   allocate objs with size ZS_MAX_ALLOC_SIZE(65536) which we promise upper
   users we can do.

 [1]  http://lkml.iu.edu/hypermail/linux/kernel/1411.2/03835.html
 [2]  http://lkml.iu.edu/hypermail/linux/kernel/1411.2/04534.html

This patch fixes this issue by dynamiclly calculating zs_size_classes when
module is loaded, allocates buffer with size ZS_MAX_ALLOC_SIZE.  Then the
max obj(size is ZS_MAX_ALLOC_SIZE) can be stored in it.

Bug: 25951511

Change-Id: Ia35e3456e94ebaf14c65a13dde8b471ebe1095ab
[akpm@linux-foundation.org: restore ZS_SIZE_CLASSES to fix bisectability]
Signed-off-by: Mahendran Ganesh <opensource.ganesh@gmail.com>
Suggested-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-05-10 13:15:28 +05:30
..
backing-dev.c arch: Mass conversion of smp_mb__*() 2014-08-15 11:45:28 -07:00
balloon_compaction.c
bootmem.c mm: concentrate modification of totalram_pages into the mm core 2014-02-07 13:49:40 -08:00
bounce.c mm/bounce.c: fix a regression where MS_SNAP_STABLE (stable pages snapshotting) was ignored 2013-10-13 16:08:33 -07:00
cleancache.c
compaction.c mm/compaction: fix wrong order check in compact_finished() 2015-03-18 13:22:28 +01:00
debug-pagealloc.c mm: Mark free pages as read only 2014-04-18 14:51:25 -07:00
dmapool.c
early_ioremap.c mm: create generic early_ioremap() support 2014-08-15 11:45:23 -07:00
fadvise.c
failslab.c
filemap_xip.c
filemap.c Page cache miss tracing using ftrace on mm/filemap 2016-05-10 13:14:58 +05:30
fremap.c mm: fix use-after-free in sys_remap_file_pages 2014-01-09 12:24:24 -08:00
frontswap.c mm: frontswap: invalidate expired data on a dup-store failure 2014-12-16 09:09:41 -08:00
highmem.c
huge_memory.c mm: numa: Do not mark PTEs pte_numa when splitting huge pages 2014-10-09 12:18:42 -07:00
hugetlb_cgroup.c
hugetlb.c mm/hugetlb: add migration entry check in __unmap_hugepage_range 2015-03-18 13:22:27 +01:00
hwpoison-inject.c
init-mm.c
internal.h Merge "mm/page_alloc: restrict max order of merging on isolated pageblock Current pageblock isolation logic could isolate each pageblock individually. This causes freepage accounting problem if freepage with pageblock order on isolate pageblock is merged with other freepage on normal pageblock. We can prevent merging by restricting max order of merging to pageblock order if freepage is on isolate pageblock." 2014-12-18 14:23:16 -08:00
interval_tree.c
Kconfig BACKPORT: mm/zpool: implement common zpool api to zbud/zsmalloc 2016-05-10 13:15:23 +05:30
Kconfig.debug defconfig: 8994: enable CONFIG_DEBUG_SLUB_PANIC_ON 2014-10-21 14:00:18 -07:00
kmemcheck.c
kmemleak-test.c
kmemleak.c kmemleak : Make kmemleak_stack_scan optional using config 2015-02-04 18:38:40 +05:30
ksm.c This is the 3.10.84 stable release 2015-08-13 14:38:09 -07:00
maccess.c
madvise.c mm: add a field to store names for private anonymous memory 2014-06-13 12:05:14 -07:00
Makefile BACKPORT: mm/zpool: implement common zpool api to zbud/zsmalloc 2016-05-10 13:15:23 +05:30
memblock.c mm/memblock: add memblock_get_current_limit 2014-04-08 09:51:10 -07:00
memcontrol.c This is the 3.10.84 stable release 2015-08-13 14:38:09 -07:00
memory_hotplug.c This is the 3.10.84 stable release 2015-08-13 14:38:09 -07:00
memory-failure.c mm/memory-failure: call shake_page() when error hits thp tail page 2015-05-17 09:51:32 -07:00
memory.c mm: swap: don't delay swap free for fast swap devices 2015-11-02 02:02:48 -08:00
mempolicy.c Merge upstream tag 'v3.10.49' into msm-3.10 2014-08-20 13:23:09 -07:00
mempool.c
migrate.c Merge upstream linux-stable v3.10.28 into msm-3.10 2014-03-24 14:28:34 -07:00
mincore.c
mlock.c mm: reorder can_do_mlock to fix audit denial 2015-08-12 18:30:46 -07:00
mm_init.c
mmap.c This is the 3.10.84 stable release 2015-08-13 14:38:09 -07:00
mmu_context.c
mmu_notifier.c mm: mmu_notifier: re-fix freed page still mapped in secondary MMU 2013-05-24 16:22:51 -07:00
mmzone.c
mprotect.c mm: add a field to store names for private anonymous memory 2014-06-13 12:05:14 -07:00
mremap.c mm, thp: close race between mremap() and split_huge_page() 2014-06-07 13:25:31 -07:00
msync.c
nobootmem.c mm/nobootmem.c: Drop __init annotation from free_bootmem_late 2014-04-21 15:28:38 -07:00
nommu.c This is the 3.10.84 stable release 2015-08-13 14:38:09 -07:00
oom_kill.c This is the 3.10.84 stable release 2015-08-13 14:38:09 -07:00
page_alloc.c This is the 3.10.84 stable release 2015-08-13 14:38:09 -07:00
page_cgroup.c cgroup/kmemleak: add kmemleak_free() for cgroup deallocations. 2014-11-14 08:47:59 -08:00
page_io.c mm: swap: Rate limit swap write errors 2013-11-14 09:27:11 -08:00
page_isolation.c mm/page_alloc: Call kernel_map_pages in unset_migrateype_isolate 2015-04-09 09:12:28 -07:00
page-writeback.c This is the 3.10.84 stable release 2015-08-13 14:38:09 -07:00
pageowner.c debugging: keep track of page owners 2014-03-28 13:33:08 -07:00
pagewalk.c mm: pagewalk: call pte_hole() for VM_PFNMAP during walk_page_range 2015-02-11 14:48:16 +08:00
percpu-km.c
percpu-vm.c percpu: perform tlb flush after pcpu_map_pages() failure 2014-10-05 14:54:13 -07:00
percpu.c Revert "percpu: free percpu allocation info for uniprocessor system" 2014-11-14 08:47:53 -08:00
pgtable-generic.c mm: fix TLB flush race between migration, and change_protection_range 2014-01-09 12:24:23 -08:00
process_vm_access.c
quicklist.c
readahead.c mm: pass readahead info down to the i/o scheduler 2013-08-22 18:08:28 -07:00
rmap.c mm: rmap: fix use-after-free in __put_anon_vma 2014-07-30 18:41:12 +05:30
shmem.c This is the 3.10.84 stable release 2015-08-13 14:38:09 -07:00
showmem.c mm: Add notifier framework for showing memory 2014-10-06 09:47:49 -07:00
slab_common.c slab_common: fix the check for duplicate slab names 2014-07-31 12:53:50 -07:00
slab.c slab: fix init_lock_keys 2013-07-21 18:21:26 -07:00
slab.h memcg: check that kmem_cache has memcg_params before accessing it 2013-09-07 22:09:58 -07:00
slob.c
slub.c mm/slub: don't wait for high-order page allocation 2016-01-13 21:45:19 -08:00
sparse-vmemmap.c
sparse.c msm: mm: Fix errors when turning on SPARSEMEM 2013-07-08 05:51:58 -07:00
swap_state.c mm: swap: don't delay swap free for fast swap devices 2015-11-02 02:02:48 -08:00
swap.c mm: close PageTail race 2014-04-03 12:01:05 -07:00
swapfile.c mm: swap: don't delay swap free for fast swap devices 2015-11-02 02:02:48 -08:00
truncate.c mm: Remove false WARN_ON from pagecache_isize_extended() 2014-11-14 08:48:00 -08:00
util.c This is the 3.10.84 stable release 2015-08-13 14:38:09 -07:00
vmalloc.c bludgeon the flounder kernel until it builds on i386 for qemu testing 2015-08-12 18:31:24 -07:00
vmpressure.c
vmscan.c mm: swap: don't delay swap free for fast swap devices 2015-11-02 02:02:48 -08:00
vmstat.c Revert "mm: add cma pcp list" 2014-08-22 11:03:00 -07:00
zbud.c zbud: add to mm/ 2013-10-18 18:24:55 -07:00
zpool.c BACKPORT: mm/zpool: use prefixed module loading 2016-05-10 13:15:24 +05:30
zsmalloc.c UPSTREAM: mm/zsmalloc: support allocating obj with size of ZS_MAX_ALLOC_SIZE 2016-05-10 13:15:28 +05:30
zswap.c mm, zswap: Fix CPU hotplug callback registration 2014-07-03 09:55:28 -07:00