{"push_id":1259500870,"size":15,"distinct_size":15,"ref":"refs/heads/ak-mm-staging-eas","head":"7204cc13dbc3eb720591816be9ecad500b610296","before":"8863ac956171944309709d253cf91af55f3c5558","commits":[{"sha":"702ecb317b03d03082b3fd8f7e15ea8489db95ef","author":{"name":"Nathan Chancellor","email":"b2febe722de126fdca89e2e24ca48c984e7dc9fc@gmail.com"},"message":"UKSM: initial support\n\nPatch taken from here: http://kerneldedup.org/en/projects/uksm/download/\n\nDoesn't appear to be anyone to give authorship to :(\n\nConflicts:\n\tfs/exec.c","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/702ecb317b03d03082b3fd8f7e15ea8489db95ef"},{"sha":"2974d11a18eab3594a5324cb417c38ea98a0e0d5","author":{"name":"Nathan Chancellor","email":"b2febe722de126fdca89e2e24ca48c984e7dc9fc@gmail.com"},"message":"defconfig: enable UKSM\n\nConflicts:\n\tarch/arm64/configs/ak_angler_defconfig","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/2974d11a18eab3594a5324cb417c38ea98a0e0d5"},{"sha":"ce709cd889740904a355b0bec17391d572635268","author":{"name":"Nathan Chancellor","email":"b2febe722de126fdca89e2e24ca48c984e7dc9fc@gmail.com"},"message":"UKSM: remove U64_MAX definition\n\nThis is already defined in include/linux/kernel.h causing a compilation error; UKSM has not been fully updated for 3.10.102","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/ce709cd889740904a355b0bec17391d572635268"},{"sha":"f4d43558b56551302f28fa70618bbf95ca32ce85","author":{"name":"Nathan Chancellor","email":"b2febe722de126fdca89e2e24ca48c984e7dc9fc@gmail.com"},"message":"UKSM: change to compound_head\n\nIn commit def52acc90faab583b124f3177d55c15d125e2d1, compound_trans_head was removed in favor of compound_head to fix a race condition. This should not change any functionality as the refractoring appears to keep everything the same with a different name. UKSM has not been fully updated for 3.10, as this change was made nearly two years ago.","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/f4d43558b56551302f28fa70618bbf95ca32ce85"},{"sha":"dcac9912d38bc060f09ba753f32b6d365b92275d","author":{"name":"Nathan Chancellor","email":"b2febe722de126fdca89e2e24ca48c984e7dc9fc@gmail.com"},"message":"ZRAM Support\n\nUPSTREAM: zram: avoid kunmap_atomic() of a NULL pointer\n\n(cherry picked from commit c406515239376fc93a30d5d03192182160cbd3fb)\n\nzram could kunmap_atomic() a NULL pointer in a rare situation: a zram\npage becomes a full-zeroed page after a partial write io.  The current\ncode doesn't handle this case and performs kunmap_atomic() on a NULL\npointer, which panics the kernel.\n\nThis patch fixes this issue.\n\nSigned-off-by: Weijie Yang <weijie.yang@samsung.com>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Dan Streetman <ddstreet@ieee.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Weijie Yang <weijie.yang.kh@gmail.com>\nAcked-by: Jerome Marchand <jmarchan@redhat.com>\nCc: <stable@vger.kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zram/zcomp: use GFP_NOIO to allocate streams\n\n(cherry picked from commit 3d5fe03a3ea013060ebba2a811aeb0f23f56aefa)\n\nWe can end up allocating a new compression stream with GFP_KERNEL from\nwithin the IO path, which may result is nested (recursive) IO\noperations.  That can introduce problems if the IO path in question is a\nreclaimer, holding some locks that will deadlock nested IOs.\n\nAllocate streams and working memory using GFP_NOIO flag, forbidding\nrecursive IO and FS operations.\n\nAn example:\n\n  inconsistent {IN-RECLAIM_FS-W} -> {RECLAIM_FS-ON-W} usage.\n  git/20158 [HC0[0]:SC0[0]:HE1:SE1] takes:\n   (jbd2_handle){+.+.?.}, at:  start_this_handle+0x4ca/0x555\n  {IN-RECLAIM_FS-W} state was registered at:\n     __lock_acquire+0x8da/0x117b\n     lock_acquire+0x10c/0x1a7\n     start_this_handle+0x52d/0x555\n     jbd2__journal_start+0xb4/0x237\n     __ext4_journal_start_sb+0x108/0x17e\n     ext4_dirty_inode+0x32/0x61\n     __mark_inode_dirty+0x16b/0x60c\n     iput+0x11e/0x274\n     __dentry_kill+0x148/0x1b8\n     shrink_dentry_list+0x274/0x44a\n     prune_dcache_sb+0x4a/0x55\n     super_cache_scan+0xfc/0x176\n     shrink_slab.part.14.constprop.25+0x2a2/0x4d3\n     shrink_zone+0x74/0x140\n     kswapd+0x6b7/0x930\n     kthread+0x107/0x10f\n     ret_from_fork+0x3f/0x70\n  irq event stamp: 138297\n  hardirqs last  enabled at (138297):  debug_check_no_locks_freed+0x113/0x12f\n  hardirqs last disabled at (138296):  debug_check_no_locks_freed+0x33/0x12f\n  softirqs last  enabled at (137818):  __do_softirq+0x2d3/0x3e9\n  softirqs last disabled at (137813):  irq_exit+0x41/0x95\n\n               other info that might help us debug this:\n   Possible unsafe locking scenario:\n         CPU0\n         ----\n    lock(jbd2_handle);\n    <Interrupt>\n      lock(jbd2_handle);\n\n                *** DEADLOCK ***\n  5 locks held by git/20158:\n   #0:  (sb_writers#7){.+.+.+}, at: [<ffffffff81155411>] mnt_want_write+0x24/0x4b\n   #1:  (&type->i_mutex_dir_key#2/1){+.+.+.}, at: [<ffffffff81145087>] lock_rename+0xd9/0xe3\n   #2:  (&sb->s_type->i_mutex_key#11){+.+.+.}, at: [<ffffffff8114f8e2>] lock_two_nondirectories+0x3f/0x6b\n   #3:  (&sb->s_type->i_mutex_key#11/4){+.+.+.}, at: [<ffffffff8114f909>] lock_two_nondirectories+0x66/0x6b\n   #4:  (jbd2_handle){+.+.?.}, at: [<ffffffff811e31db>] start_this_handle+0x4ca/0x555\n\n               stack backtrace:\n  CPU: 2 PID: 20158 Comm: git Not tainted 4.1.0-rc7-next-20150615-dbg-00016-g8bdf555-dirty #211\n  Call Trace:\n    dump_stack+0x4c/0x6e\n    mark_lock+0x384/0x56d\n    mark_held_locks+0x5f/0x76\n    lockdep_trace_alloc+0xb2/0xb5\n    kmem_cache_alloc_trace+0x32/0x1e2\n    zcomp_strm_alloc+0x25/0x73 [zram]\n    zcomp_strm_multi_find+0xe7/0x173 [zram]\n    zcomp_strm_find+0xc/0xe [zram]\n    zram_bvec_rw+0x2ca/0x7e0 [zram]\n    zram_make_request+0x1fa/0x301 [zram]\n    generic_make_request+0x9c/0xdb\n    submit_bio+0xf7/0x120\n    ext4_io_submit+0x2e/0x43\n    ext4_bio_write_page+0x1b7/0x300\n    mpage_submit_page+0x60/0x77\n    mpage_map_and_submit_buffers+0x10f/0x21d\n    ext4_writepages+0xc8c/0xe1b\n    do_writepages+0x23/0x2c\n    __filemap_fdatawrite_range+0x84/0x8b\n    filemap_flush+0x1c/0x1e\n    ext4_alloc_da_blocks+0xb8/0x117\n    ext4_rename+0x132/0x6dc\n    ? mark_held_locks+0x5f/0x76\n    ext4_rename2+0x29/0x2b\n    vfs_rename+0x540/0x636\n    SyS_renameat2+0x359/0x44d\n    SyS_rename+0x1e/0x20\n    entry_SYSCALL_64_fastpath+0x12/0x6f\n\n[minchan@kernel.org: add stable mark]\nSigned-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nAcked-by: Minchan Kim <minchan@kernel.org>\nCc: Kyeongdon Kim <kyeongdon.kim@lge.com>\nCc: <stable@vger.kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zram: try vmalloc() after kmalloc()\n\n(cherry picked from commit d913897abace843bba20249f3190167f7895e9c3)\n\nWhen we're using LZ4 multi compression streams for zram swap, we found\nout page allocation failure message in system running test.  That was\nnot only once, but a few(2 - 5 times per test).  Also, some failure\ncases were continually occurring to try allocation order 3.\n\nIn order to make parallel compression private data, we should call\nkzalloc() with order 2/3 in runtime(lzo/lz4).  But if there is no order\n2/3 size memory to allocate in that time, page allocation fails.  This\npatch makes to use vmalloc() as fallback of kmalloc(), this prevents\npage alloc failure warning.\n\nAfter using this, we never found warning message in running test, also\nIt could reduce process startup latency about 60-120ms in each case.\n\nFor reference a call trace :\n\n    Binder_1: page allocation failure: order:3, mode:0x10c0d0\n    CPU: 0 PID: 424 Comm: Binder_1 Tainted: GW 3.10.49-perf-g991d02b-dirty #20\n    Call trace:\n      dump_backtrace+0x0/0x270\n      show_stack+0x10/0x1c\n      dump_stack+0x1c/0x28\n      warn_alloc_failed+0xfc/0x11c\n      __alloc_pages_nodemask+0x724/0x7f0\n      __get_free_pages+0x14/0x5c\n      kmalloc_order_trace+0x38/0xd8\n      zcomp_lz4_create+0x2c/0x38\n      zcomp_strm_alloc+0x34/0x78\n      zcomp_strm_multi_find+0x124/0x1ec\n      zcomp_strm_find+0xc/0x18\n      zram_bvec_rw+0x2fc/0x780\n      zram_make_request+0x25c/0x2d4\n      generic_make_request+0x80/0xbc\n      submit_bio+0xa4/0x15c\n      __swap_writepage+0x218/0x230\n      swap_writepage+0x3c/0x4c\n      shrink_page_list+0x51c/0x8d0\n      shrink_inactive_list+0x3f8/0x60c\n      shrink_lruvec+0x33c/0x4cc\n      shrink_zone+0x3c/0x100\n      try_to_free_pages+0x2b8/0x54c\n      __alloc_pages_nodemask+0x514/0x7f0\n      __get_free_pages+0x14/0x5c\n      proc_info_read+0x50/0xe4\n      vfs_read+0xa0/0x12c\n      SyS_read+0x44/0x74\n    DMA: 3397*4kB (MC) 26*8kB (RC) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB\n         0*512kB 0*1024kB 0*2048kB 0*4096kB = 13796kB\n\n[minchan@kernel.org: change vmalloc gfp and adding comment about gfp]\n[sergey.senozhatsky@gmail.com: tweak comments and styles]\nSigned-off-by: Kyeongdon Kim <kyeongdon.kim@lge.com>\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nAcked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nSergey Senozhatsky <sergey.senozhatsky.work@gmail.com>\nCc: <stable@vger.kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zram: pass gfp from zcomp frontend to backend\n\n(cherry picked from commit 75d8947a36d0c9aedd69118d1f14bf424005c7c2)\n\nEach zcomp backend uses own gfp flag but it's pointless because the\ncontext they could be called is driven by upper layer(ie, zcomp\nfrontend).  As well, zcomp frondend could call them in different\ncontext.  One context(ie, zram init part) is it should be better to make\nsure successful allocation other context(ie, further stream allocation\npart for accelarating I/O speed) is just optional so let's pass gfp down\nfrom driver (ie, zcomp frontend) like normal MM convention.\n\n[sergey.senozhatsky@gmail.com: add missing __vmalloc zero and highmem gfps]\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nSigned-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zram/zcomp: do not zero out zcomp private pages\n\n(cherry picked from commit e02d238c9852a91b30da9ea32ce36d1416cdc683)\n\nDo not __GFP_ZERO allocated zcomp ->private pages.  We keep allocated\nstreams around and use them for read/write requests, so we supply a\nzeroed out ->private to compression algorithm as a scratch buffer only\nonce -- the first time we use that stream.  For the rest of IO requests\nserved by this stream ->private usually contains some temporarily data\nfrom the previous requests.\n\nSigned-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nAcked-by: Minchan Kim <minchan@kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: block: disable entropy contributions for nonrot devices\n\n(cherry picked from commit b277da0a8a594308e17881f4926879bd5fca2a2d)\n\nClear QUEUE_FLAG_ADD_RANDOM in all block drivers that set\nQUEUE_FLAG_NONROT.\n\nHistorically, all block devices have automatically made entropy\ncontributions.  But as previously stated in commit e2e1a148 (\"block: add\nsysfs knob for turning off disk entropy contributions\"):\n    - On SSD disks, the completion times aren't as random as they\n      are for rotational drives. So it's questionable whether they\n      should contribute to the random pool in the first place.\n    - Calling add_disk_randomness() has a lot of overhead.\n\nThere are more reliable sources for randomness than non-rotational block\ndevices.  From a security perspective it is better to err on the side of\ncaution than to allow entropy contributions from unreliable \"random\"\nsources.\n\nSigned-off-by: Mike Snitzer <snitzer@redhat.com>\nSigned-off-by: Jens Axboe <axboe@fb.com>\n\nmm: swap: don't delay swap free for fast swap devices\n\nThere are couple of issues with swapcache usage when ZRAM is used\nas swap device.\n1) Kernel does a swap readahead which can be around 6 to 8 pages\ndepending on total ram, which is not required for zram since\naccesses are fast.\n2) Kernel delays the freeing up of swapcache expecting a later hit,\nwhich again is useless in the case of zram.\n3) This is not related to swapcache, but zram usage itself.\nAs mentioned in (2) kernel delays freeing of swapcache, but along with\nthat it delays zram compressed page free also. i.e. there can be 2 copies,\nthough one is compressed.\n\nThis patch addresses these issues using two new flags\nQUEUE_FLAG_FAST and SWP_FAST, to indicate that accesses to the device\nwill be fast and cheap, and instructs the swap layer to free up\nswap space agressively, and not to do read ahead.\n\nChange-Id: I5d2d5176a5f9420300bb2f843f6ecbdb25ea80e4\nSigned-off-by: Vinayak Menon <vinmenon@codeaurora.org>\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nUPSTREAM: zram: correct offset usage in zram_bio_discard\n\n(cherry-pick from commit 38515c73398a4c58059ecf1087e844561b58ee0f)\n\nWe want to skip the physical block(PAGE_SIZE) which is partially covered\nby the discard bio, so we check the remaining size and subtract it if\nthere is a need to goto the next physical block.\n\nThe current offset usage in zram_bio_discard is incorrect, it will cause\nits upper filesystem breakdown.  Consider the following scenario:\n\nOn some architecture or config, PAGE_SIZE is 64K for example, filesystem\nis set up on zram disk without PAGE_SIZE aligned, a discard bio leads to a\noffset = 4K and size=72K, normally, it should not really discard any\nphysical block as it partially cover two physical blocks.  However, with\nthe current offset usage, it will discard the second physical block and\nfree its memory, which will cause filesystem breakdown.\n\nThis patch corrects the offset usage in zram_bio_discard.\n\nBug: 25951511\n\nChange-Id: I139d6adfd7ee390ce7cd421c7ea5f9a9e3f285ba\nSigned-off-by: Weijie Yang <weijie.yang@samsung.com>\nCc: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nAcked-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Bob Liu <bob.liu@oracle.com>\nCc: <stable@vger.kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zram: revalidate disk after capacity change\n\n(cherry-pick from commit 2e32baea46ce542c561a519414c840295b229c8f)\n\nAlexander reported mkswap on /dev/zram0 is failed if other process is\nopening the block device file.\n\nStep is as follows,\n\n0. Reset the unused zram device.\n1. Use a program that opens /dev/zram0 with O_RDWR and sleeps\n   until killed.\n2. While that program sleeps, echo the correct value to\n   /sys/block/zram0/disksize.\n3. Verify (e.g. in /proc/partitions) that the disk size is applied\n   correctly. It is.\n4. While that program still sleeps, attempt to mkswap /dev/zram0.\n   This fails: mkswap: error: swap area needs to be at least 40 KiB\n\nWhen I investigated, the size get by ioctl(fd, BLKGETSIZE64, xxx) on\nmkswap to get a size of blockdev was zero although zram0 has right size by\n2.\n\nThe reason is zram didn't revalidate disk after changing capacity so that\nsize of blockdev's inode is not uptodate until all of file is close.\n\nThis patch should fix the BUG.\n\nBug: 25951511\n\nChange-Id: Iacb696b3443d5dfead36c120b9f97167a5a4b631\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nReported-by: Alexander E. Patrakov <patrakov@gmail.com>\nTested-by: Alexander E. Patrakov <patrakov@gmail.com>\nReviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Nitin Gupta <ngupta@vflare.org>\nAcked-by: Jerome Marchand <jmarchan@redhat.com>\nCc: <stable@vger.kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zram: avoid lockdep splat by revalidate_disk\n\n(cherry-pick from commit b4c5c60920e3b0c4598f43e7317559f6aec51531)\n\nSasha reported lockdep warning [1] introduced by [2].\n\nIt could be fixed by doing disk revalidation out of the init_lock.  It's\nokay because disk capacity change is protected by init_lock so that\nrevalidate_disk always sees up-to-date value so there is no race.\n\n[1] https://lkml.org/lkml/2014/7/3/735\n[2] zram: revalidate disk after capacity change\n\nFixes 2e32baea46ce (\"zram: revalidate disk after capacity change\").\n\nBug: 25951511\n\nChange-Id: Id4498d2993849b57bf37b2fa17470c39e8837b58\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nReported-by: Sasha Levin <sasha.levin@oracle.com>\nCc: \"Alexander E. Patrakov\" <patrakov@gmail.com>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCC: <stable@vger.kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zram: rename struct `table' to `zram_table_entry'\n\n(cherry-pick from commit cb8f2eec3c5c87e31219c5e58625b8e890004e48)\n\nAndrew Morton has recently noted that `struct table' actually represents\ntable entry and, thus, should be renamed.  Rename to `zram_table_entry'.\n\nBug: 25951511\n\nChange-Id: I862e174bb6d5241ecfd950bc992f41da83dfaff5\nSigned-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Weijie Yang <weijie.yang@samsung.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zram: remove unused SECTOR_SIZE define\n\n(cherry-pick from commit a830eff749eb2bf906783f6bf74a74dad3de3aea)\n\nDrop SECTOR_SIZE define, because it's not used.\n\nBug: 25951511\n\nChange-Id: I5f38ff27532f452873386266f56126f61585e353\nSigned-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Weijie Yang <weijie.yang@samsung.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zram: use size_t instead of u16\n\n(cherry-pick from commit 023b409f9dac4cdea3322009f2e592068558690c)\n\nSome architectures (eg, hexagon and PowerPC) could use PAGE_SHIFT of 16\nor more.  In these cases u16 is not sufficiently large to represent a\ncompressed page's size so use size_t.\n\nBug: 25951511\n\nChange-Id: Ia2c4b12d11e55cd6ed4329b57bc715aa68b9500a\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nReported-by: Weijie Yang <weijie.yang@samsung.com>\nAcked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: Nitin Gupta <ngupta@vflare.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nBACKPORT: zram: replace global tb_lock with fine grain lock\n\n(cherry-pick from commit d2d5e762c8990c4031890e03565983a05febd64a)\n\nCurrently, we use a rwlock tb_lock to protect concurrent access to the\nwhole zram meta table.  However, according to the actual access model,\nthere is only a small chance for upper user to access the same\ntable[index], so the current lock granularity is too big.\n\nThe idea of optimization is to change the lock granularity from whole\nmeta table to per table entry (table -> table[index]), so that we can\nprotect concurrent access to the same table[index], meanwhile allow the\nmaximum concurrency.\n\nWith this in mind, several kinds of locks which could be used as a\nper-entry lock were tested and compared:\n\nTest environment:\nx86-64 Intel Core2 Q8400, system memory 4GB, Ubuntu 12.04,\nkernel v3.15.0-rc3 as base, zram with 4 max_comp_streams LZO.\n\niozone test:\niozone -t 4 -R -r 16K -s 200M -I +Z\n(1GB zram with ext4 filesystem, take the average of 10 tests, KB/s)\n\n      Test       base      CAS    spinlock    rwlock   bit_spinlock\n-------------------------------------------------------------------\n Initial write  1381094   1425435   1422860   1423075   1421521\n       Rewrite  1529479   1641199   1668762   1672855   1654910\n          Read  8468009  11324979  11305569  11117273  10997202\n       Re-read  8467476  11260914  11248059  11145336  10906486\n  Reverse Read  6821393   8106334   8282174   8279195   8109186\n   Stride read  7191093   8994306   9153982   8961224   9004434\n   Random read  7156353   8957932   9167098   8980465   8940476\nMixed workload  4172747   5680814   5927825   5489578   5972253\n  Random write  1483044   1605588   1594329   1600453   1596010\n        Pwrite  1276644   1303108   1311612   1314228   1300960\n         Pread  4324337   4632869   4618386   4457870   4500166\n\nTo enhance the possibility of access the same table[index] concurrently,\nset zram a small disksize(10MB) and let threads run with large loop\ncount.\n\nfio test:\nfio --bs=32k --randrepeat=1 --randseed=100 --refill_buffers\n--scramble_buffers=1 --direct=1 --loops=3000 --numjobs=4\n--filename=/dev/zram0 --name=seq-write --rw=write --stonewall\n--name=seq-read --rw=read --stonewall --name=seq-readwrite\n--rw=rw --stonewall --name=rand-readwrite --rw=randrw --stonewall\n(10MB zram raw block device, take the average of 10 tests, KB/s)\n\n    Test     base     CAS    spinlock    rwlock  bit_spinlock\n-------------------------------------------------------------\nseq-write   933789   999357   1003298    995961   1001958\n seq-read  5634130  6577930   6380861   6243912   6230006\n   seq-rw  1405687  1638117   1640256   1633903   1634459\n  rand-rw  1386119  1614664   1617211   1609267   1612471\n\nAll the optimization methods show a higher performance than the base,\nhowever, it is hard to say which method is the most appropriate.\n\nOn the other hand, zram is mostly used on small embedded system, so we\ndon't want to increase any memory footprint.\n\nThis patch pick the bit_spinlock method, pack object size and page_flag\ninto an unsigned long table.value, so as to not increase any memory\noverhead on both 32-bit and 64-bit system.\n\nOn the third hand, even though different kinds of locks have different\nperformances, we can ignore this difference, because: if zram is used as\nzram swapfile, the swap subsystem can prevent concurrent access to the\nsame swapslot; if zram is used as zram-blk for set up filesystem on it,\nthe upper filesystem and the page cache also prevent concurrent access\nof the same block mostly.  So we can ignore the different performances\namong locks.\n\nBug: 25951511\n\nChange-Id: I367a1dde82cd49e1dd4596401fd1f3870fd3b621\nAcked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nReviewed-by: Davidlohr Bueso <davidlohr@hp.com>\nSigned-off-by: Weijie Yang <weijie.yang@samsung.com>\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: Nitin Gupta <ngupta@vflare.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zram: fix incorrect stat with failed_reads\n\n(cherry-pick from commit 0cf1e9d6c34d4c82ac3af8015594849814843d36)\n\nSince we allocate a temporary buffer in zram_bvec_read to handle partial\npage operations in commit 924bd88d703e (\"Staging: zram: allow partial\npage operations\"), our ->failed_reads value may be incorrect as we do\nnot increase its value when failing to allocate the temporary buffer.\n\nLet's fix this issue and correct the annotation of failed_reads.\n\nBug: 25951511\n\nChange-Id: Id3e857b5cda53187c264ce3e5779c38f7b4aa610\nSigned-off-by: Chao Yu <chao2.yu@samsung.com>\nAcked-by: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nAcked-by: Jerome Marchand <jmarchan@redhat.com>\nAcked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: add Kconfig for enabling page table method\n\n(cherry-pick from commit 1b945aeef0b9cb5e98d682c310272b08198e54b5)\n\nZsmalloc has two methods 1) copy-based and 2) pte based to\naccess objects that span two pages.\nYou can see history why we supported two approach from [1].\n\nBut it was bad choice that adding hard coding to select arch\nwhich want to use pte based method because there are lots of\nSoC in an architecure and they can have different cache size,\nCPU speed and so on so it would be better to expose it to user\nas selectable Kconfig option like Andrew Morton suggested.\n\n[1] https://lkml.org/lkml/2012/7/11/58\n\nBug: 25951511\n\nChange-Id: Ic6855e8fefc7a0f36db896e8b03869c143e982d6\nAcked-by: Nitin Gupta <ngupta@vflare.org>\nReviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\n\nBACKPORT: zsmalloc: add more comment\n\n(cherry-pick from commit c3e3e88adccb3119b69484c56798ec616307a94f)\n\nThis patch adds lots of comments and it will help others\nto review and enhance.\n\nBug: 25951511\n\nChange-Id: I2c1edf24e917c2d51ef68a9987d81f9b6a4a2bd2\nSigned-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>\nSigned-off-by: Nitin Gupta <ngupta@vflare.org>\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\n\nUPSTREAM: mm/Kconfig: fix URL for zsmalloc benchmark\n\n(cherry-pick from commit 2216ee853017f9c9371106c5c02d4fe42f61cbfa)\n\nThe help text for CONFIG_PGTABLE_MAPPING has an incorrect URL.  While\nwe're at it, remove the unnecessary footnote notation.\n\nBug: 25951511\n\nChange-Id: Ia2eb06b2a5d29960b51f0b6558ef5041fd9c03fa\nSigned-off-by: Ben Hutchings <ben@decadent.org.uk>\nAcked-by: Minchan Kim <minchan@kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: fixup trivial zs size classes value in comments\n\n(cherry-pick from commit 7eb52512a977854eca51d9b692c2f3be8a0e5eeb)\n\nAccording to calculation, ZS_SIZE_CLASSES value is 255 on systems with 4K\npage size, not 254.  The old value may forget count the ZS_MIN_ALLOC_SIZE\nin.\n\nThis patch fixes this trivial issue in the comments.\n\nBug: 25951511\n\nChange-Id: I7f3039f14a6813bc2e97972b6968ac09d87202ed\nSigned-off-by: Weijie Yang <weijie.yang@samsung.com>\nCc: Minchan Kim <minchan@kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nBACKPORT: mm/zpool: implement common zpool api to zbud/zsmalloc\n\n(cherry-pick from commit af8d417a04564bca0348e7e3c749ab12a3e837ad)\n\nAdd zpool api.\n\nzpool provides an interface for memory storage, typically of compressed\nmemory.  Users can select what backend to use; currently the only\nimplementations are zbud, a low density implementation with up to two\ncompressed pages per storage page, and zsmalloc, a higher density\nimplementation with multiple compressed pages per storage page.\n\nBug: 25951511\n\nChange-Id: I25da4c5454ad97c35e7f666df936d4c199f656a4\nSigned-off-by: Dan Streetman <ddstreet@ieee.org>\nTested-by: Seth Jennings <sjennings@variantweb.net>\nCc: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Weijie Yang <weijie.yang@samsung.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nBACKPORT: mm/zpool: zbud/zsmalloc implement zpool\n\n(cherry-pick from commit c795779df29e180738568d2a5eb3a42f3b5e47f0)\n\nUpdate zbud and zsmalloc to implement the zpool api.\n\nBug: 25951511\n\nChange-Id: Ib58729c1efeb4834d566d29f9abf33fec1f7f79d\n[fengguang.wu@intel.com: make functions static]\nSigned-off-by: Dan Streetman <ddstreet@ieee.org>\nTested-by: Seth Jennings <sjennings@variantweb.net>\nCc: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Weijie Yang <weijie.yang@samsung.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nBACKPORT: mm/zpool: use prefixed module loading\n\n(cherry-pick from commit 137f8cff505ace6251dc442c7aa973d60c801a79)\n\nTo avoid potential format string expansion via module parameters, do not\nuse the zpool type directly in request_module() without a format string.\nAdditionally, to avoid arbitrary modules being loaded via zpool API\n(e.g.  via the zswap_zpool_type module parameter) add a \"zpool-\" prefix\nto the requested module, as well as module aliases for the existing\nzpool types (zbud and zsmalloc).\n\nBug: 25951511\n\nChange-Id: Id04e543f6e12e73e72bf79bdde4b1b13c35d7cae\nSigned-off-by: Kees Cook <keescook@chromium.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nCc: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nAcked-by: Dan Streetman <ddstreet@ieee.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: move pages_allocated to zs_pool\n\n(cherry-pick from commit 13de8933c96b4557f667c337676f05274e017f83)\n\nCurrently, zram has no feature to limit memory so theoretically zram can\ndeplete system memory.  Users have asked for a limit several times as even\nwithout exhaustion zram makes it hard to control memory usage of the\nplatform.  This patchset adds the feature.\n\nPatch 1 makes zs_get_total_size_bytes faster because it would be used\nfrequently in later patches for the new feature.\n\nPatch 2 changes zs_get_total_size_bytes's return unit from bytes to page\nso that zsmalloc doesn't need unnecessary operation(ie, << PAGE_SHIFT).\n\nPatch 3 adds new feature.  I added the feature into zram layer, not\nzsmalloc because limiation is zram's requirement, not zsmalloc so any\nother user using zsmalloc(ie, zpool) shouldn't affected by unnecessary\nbranch of zsmalloc.  In future, if every users of zsmalloc want the\nfeature, then, we could move the feature from client side to zsmalloc\neasily but vice versa would be painful.\n\nPatch 4 adds news facility to report maximum memory usage of zram so that\nthis avoids user polling frequently via /sys/block/zram0/ mem_used_total\nand ensures transient max are not missed.\n\nThis patch (of 4):\n\npages_allocated has counted in size_class structure and when user of\nzsmalloc want to see total_size_bytes, it should gather all of count from\neach size_class to report the sum.\n\nIt's not bad if user don't see the value often but if user start to see\nthe value frequently, it would be not a good deal for performance pov.\n\nThis patch moves the count from size_class to zs_pool so it could reduce\nmemory footprint (from [255 * 8byte] to [sizeof(atomic_long_t)]).\n\nBug: 25951511\n\nChange-Id: I05526575b81c95a12a7f8f0ef05040ed18b5fa6f\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nReviewed-by: Dan Streetman <ddstreet@ieee.org>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: <juno.choi@lge.com>\nCc: <seungho1.park@lge.com>\nCc: Luigi Semenzato <semenzato@google.com>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nReviewed-by: David Horner <ds2horner@gmail.com>\nCc: Joonsoo Kim <iamjoonsoo.kim@lge.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: change return value unit of zs_get_total_size_bytes\n\n(cherry-pick from commit 722cdc17232f0f684011407f7cf3c40d39457971)\n\nzs_get_total_size_bytes returns a amount of memory zsmalloc consumed with\n*byte unit* but zsmalloc operates *page unit* rather than byte unit so\nlet's change the API so benefit we could get is that reduce unnecessary\noverhead (ie, change page unit with byte unit) in zsmalloc.\n\nSince return type is pages, \"zs_get_total_pages\" is better than\n\"zs_get_total_size_bytes\".\n\nBug: 25951511\n\nChange-Id: I2cbd9426483ae31c846923594e2cc3a8028e6cc2\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nReviewed-by: Dan Streetman <ddstreet@ieee.org>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: <juno.choi@lge.com>\nCc: <seungho1.park@lge.com>\nCc: Luigi Semenzato <semenzato@google.com>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nCc: David Horner <ds2horner@gmail.com>\nCc: Joonsoo Kim <iamjoonsoo.kim@lge.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zram: zram memory size limitation\n\n(cherry-pick from commit 9ada9da9573f3460b156b7755c093e30b258eacb)\n\nSince zram has no control feature to limit memory usage, it makes hard to\nmanage system memrory.\n\nThis patch adds new knob \"mem_limit\" via sysfs to set up the a limit so\nthat zram could fail allocation once it reaches the limit.\n\nIn addition, user could change the limit in runtime so that he could\nmanage the memory more dynamically.\n\nInitial state is no limit so it doesn't break old behavior.\n\nBug: 25951511\n\nChange-Id: I306a9582a9273c521d90b607a3ba2b44860a6273\n[akpm@linux-foundation.org: fix typo, per Sergey]\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nCc: Dan Streetman <ddstreet@ieee.org>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: <juno.choi@lge.com>\nCc: <seungho1.park@lge.com>\nCc: Luigi Semenzato <semenzato@google.com>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nCc: David Horner <ds2horner@gmail.com>\nCc: Joonsoo Kim <iamjoonsoo.kim@lge.com>\nCc: Minchan Kim <minchan@kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zram: report maximum used memory\n\n(cherry-pick from commit 461a8eee6af3b55745be64bea403ed0b743563cf)\n\nNormally, zram user could get maximum memory usage zram consumed via\npolling mem_used_total with sysfs in userspace.\n\nBut it has a critical problem because user can miss peak memory usage\nduring update inverval of polling.  For avoiding that, user should poll it\nwith shorter interval(ie, 0.0000000001s) with mlocking to avoid page fault\ndelay when memory pressure is heavy.  It would be troublesome.\n\nThis patch adds new knob \"mem_used_max\" so user could see the maximum\nmemory usage easily via reading the knob and reset it via \"echo 0 >\n/sys/block/zram0/mem_used_max\".\n\nBug: 25951511\n\nChange-Id: I117b162ce92f1601b2ad2af86ab205c6c9ca6769\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nReviewed-by: Dan Streetman <ddstreet@ieee.org>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: <juno.choi@lge.com>\nCc: <seungho1.park@lge.com>\nCc: Luigi Semenzato <semenzato@google.com>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nReviewed-by: David Horner <ds2horner@gmail.com>\nCc: Joonsoo Kim <iamjoonsoo.kim@lge.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: mm/zsmalloc.c: correct comment for fullness group computation\n\n(cherry-pick from commit 6dd9737e31504f9377a8a19810ea4922e88516c1)\n\nThe letter 'f' in \"n <= N/f\" stands for fullness_threshold_frac, not\n1/fullness_threshold_frac.\n\nBug: 25951511\n\nChange-Id: I3d3f090fab39fca1011999ea12e9aab187504e39\nSigned-off-by: Wang Sheng-Hui <shhuiw@gmail.com>\nAcked-by: Minchan Kim <minchan@kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: simplify init_zspage free obj linking\n\n(cherry-pick from commit 5538c562377580947916b3366898f1eb5f53768e)\n\nChange zsmalloc init_zspage() logic to iterate through each object on each\nof its pages, checking the offset to verify the object is on the current\npage before linking it into the zspage.\n\nThe current zsmalloc init_zspage free object linking code has logic that\nrelies on there only being one page per zspage when PAGE_SIZE is a\nmultiple of class->size.  It calculates the number of objects for the\ncurrent page, and iterates through all of them plus one, to account for\nthe assumed partial object at the end of the page.  While this currently\nworks, the logic can be simplified to just link the object at each\nsuccessive offset until the offset is larger than PAGE_SIZE, which does\nnot rely on PAGE_SIZE being a multiple of class->size.\n\nBug: 25951511\n\nChange-Id: I89e562a18b083f24f4697b4154d5b238becb36e6\nSigned-off-by: Dan Streetman <ddstreet@ieee.org>\nAcked-by: Minchan Kim <minchan@kernel.org>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: merge size_class to reduce fragmentation\n\n(cherry-pick from commit 9eec4cd53f9865b733dc78cf5f6465871beed014)\n\nzsmalloc has many size_classes to reduce fragmentation and they are in 16\nbytes unit, for example, 16, 32, 48, etc., if PAGE_SIZE is 4096.  And,\nzsmalloc has constraint that each zspage has 4 pages at maximum.\n\nIn this situation, we can see interesting aspect.  Let's think about\nsize_class for 1488, 1472, ..., 1376.  To prevent external fragmentation,\nthey uses 4 pages per zspage and so all they can contain 11 objects at\nmaximum.\n\n16384 (4096 * 4) = 1488 * 11 + remains\n16384 (4096 * 4) = 1472 * 11 + remains\n16384 (4096 * 4) = ...\n16384 (4096 * 4) = 1376 * 11 + remains\n\nIt means that they have same characteristics and classification between\nthem isn't needed.  If we use one size_class for them, we can reduce\nfragementation and save some memory since both the 1488 and 1472 sized\nclasses can only fit 11 objects into 4 pages, and an object that's 1472\nbytes can fit into an object that's 1488 bytes, merging these classes to\nalways use objects that are 1488 bytes will reduce the total number of\nsize classes.  And reducing the total number of size classes reduces\noverall fragmentation, because a wider range of compressed pages can fit\ninto a single size class, leaving less unused objects in each size class.\n\nFor this purpose, this patch implement size_class merging.  If there is\nsize_class that have same pages_per_zspage and same number of objects per\nzspage with previous size_class, we don't create new size_class.  Instead,\nwe use previous, same characteristic size_class.  With this way, above\nexample sizes (1488, 1472, ..., 1376) use just one size_class so we can\nget much more memory utilization.\n\nBelow is result of my simple test.\n\nTEST ENV: EXT4 on zram, mount with discard option WORKLOAD: untar kernel\nsource code, remove directory in descending order in size.  (drivers arch\nfs sound include net Documentation firmware kernel tools)\n\nEach line represents orig_data_size, compr_data_size, mem_used_total,\nfragmentation overhead (mem_used - compr_data_size) and overhead ratio\n(overhead to compr_data_size), respectively, after untar and remove\noperation is executed.\n\n* untar-nomerge.out\n\norig_size compr_size used_size overhead overhead_ratio\n525.88MB 199.16MB 210.23MB  11.08MB 5.56%\n288.32MB  97.43MB 105.63MB   8.20MB 8.41%\n177.32MB  61.12MB  69.40MB   8.28MB 13.55%\n146.47MB  47.32MB  56.10MB   8.78MB 18.55%\n124.16MB  38.85MB  48.41MB   9.55MB 24.58%\n103.93MB  31.68MB  40.93MB   9.25MB 29.21%\n 84.34MB  22.86MB  32.72MB   9.86MB 43.13%\n 66.87MB  14.83MB  23.83MB   9.00MB 60.70%\n 60.67MB  11.11MB  18.60MB   7.49MB 67.48%\n 55.86MB   8.83MB  16.61MB   7.77MB 88.03%\n 53.32MB   8.01MB  15.32MB   7.31MB 91.24%\n\n* untar-merge.out\n\norig_size compr_size used_size overhead overhead_ratio\n526.23MB 199.18MB 209.81MB  10.64MB 5.34%\n288.68MB  97.45MB 104.08MB   6.63MB 6.80%\n177.68MB  61.14MB  66.93MB   5.79MB 9.47%\n146.83MB  47.34MB  52.79MB   5.45MB 11.51%\n124.52MB  38.87MB  44.30MB   5.43MB 13.96%\n104.29MB  31.70MB  36.83MB   5.13MB 16.19%\n 84.70MB  22.88MB  27.92MB   5.04MB 22.04%\n 67.11MB  14.83MB  19.26MB   4.43MB 29.86%\n 60.82MB  11.10MB  14.90MB   3.79MB 34.17%\n 55.90MB   8.82MB  12.61MB   3.79MB 42.97%\n 53.32MB   8.01MB  11.73MB   3.73MB 46.53%\n\nAs you can see above result, merged one has better utilization (overhead\nratio, 5th column) and uses less memory (mem_used_total, 3rd column).\n\nBug: 25951511\n\nChange-Id: I00825d2b8de666abb7a0d8b47348b89e8af80571\nSigned-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>\nCc: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nReviewed-by: Dan Streetman <ddstreet@ieee.org>\nCc: Luigi Semenzato <semenzato@google.com>\nCc: <juno.choi@lge.com>\nCc: \"seungho1.park\" <seungho1.park@lge.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: fix zs_init cpu notifier error handling\n\n(cherry-pick from commit b1b00a5b8a6cf32e3973507decf1216709b55072)\n\nMahendran Ganesh reported that zpool-enabled zsmalloc should not call\nzpool_unregister_driver() from zs_init() if cpu notifier registration has\nfailed, because error handling is performed before we register the driver\nvia zpool_register_driver() call.\n\nFactor out cpu notifier registration and unregistration code and fix\nzs_init() error handling.\n\nBug: 25951511\n\nChange-Id: I9311d16de84accd9c5d3f2a333b30fe189a37222\nlink: http://lkml.iu.edu//hypermail/linux/kernel/1411.1/04156.html\n[akpm@linux-foundation.org: squash bogus gcc warning]\n[akpm@linux-foundation.org: use __init and __exit]\nSigned-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nReported-by: Mahendran Ganesh <opensource.ganesh@gmail.com>\nCc: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: correct fragile [kmap|kunmap]_atomic use\n\n(cherry-pick from commit af4ee5e977acb150371c28bd85cb7e34cac48b13)\n\nThe kunmap_atomic should use virtual address getting by kmap_atomic.\nHowever, some pieces of code in zsmalloc uses modified address, not the\none got by kmap_atomic for kunmap_atomic.\n\nIt's okay for working because zsmalloc modifies the address inner\nPAGE_SIZE bounday so it works with current kmap_atomic's implementation.\nBut it's still fragile with potential changing of kmap_atomic so let's\ncorrect it.\n\nI got a subtle bug when I implemented a new feature of zsmalloc\n(compaction) due to a link's mishandling (the link was over page\nboundary).  Although it was totally my mistake, it took a while to find\nthe cause because an unpredictable kmapped address was unmapped causing an\nalmost random crash.\n\nBug: 25951511\n\nChange-Id: I9337684d102af93ec600077bf4c9658a942c8d09\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Dan Streetman <ddstreet@ieee.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nCc: Jerome Marchand <jmarchan@redhat.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: mm/zsmalloc: support allocating obj with size of ZS_MAX_ALLOC_SIZE\n\n(cherry-pick from commit 40f9fb8cffc6a20ae269e3b43dfba7a4f65d7f50)\n\nI sent a patch [1] for unnecessary check in zsmalloc.  And Minchan Kim\nfound zsmalloc even does not support allocating an obj with the size of\nZS_MAX_ALLOC_SIZE in some situations.\n\nFor example:\n   In system with 64KB PAGE_SIZE and 32 bit of physical addr. Then:\n   ZS_MIN_ALLOC_SIZE is 32 bytes which is calculated by:\n      MAX(32, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS))\n   ZS_MAX_ALLOC_SIZE is 64KB(in current code, is PAGE_SIZE)\n   ZS_SIZE_CLASS_DELTA is 256 bytes\n   So, ZS_SIZE_CLASSES = (ZS_MAX_ALLOC_SIZE - ZS_MIN_ALLOC_SIZE) /\n                          ZS_SIZE_CLASS_DELTA + 1\n                       = 256\n\n   In zs_create_pool(), the max size obj which can be allocated will be:\n      ZS_MIN_ALLOC_SIZE + i * ZS_SIZE_CLASS_DELTA = 32 + 255*256 = 65312\n\n   We can see that 65312 < 65536 (ZS_MAX_ALLOC_SIZE). So we can NOT\n   allocate objs with size ZS_MAX_ALLOC_SIZE(65536) which we promise upper\n   users we can do.\n\n [1]  http://lkml.iu.edu/hypermail/linux/kernel/1411.2/03835.html\n [2]  http://lkml.iu.edu/hypermail/linux/kernel/1411.2/04534.html\n\nThis patch fixes this issue by dynamiclly calculating zs_size_classes when\nmodule is loaded, allocates buffer with size ZS_MAX_ALLOC_SIZE.  Then the\nmax obj(size is ZS_MAX_ALLOC_SIZE) can be stored in it.\n\nBug: 25951511\n\nChange-Id: Ia35e3456e94ebaf14c65a13dde8b471ebe1095ab\n[akpm@linux-foundation.org: restore ZS_SIZE_CLASSES to fix bisectability]\nSigned-off-by: Mahendran Ganesh <opensource.ganesh@gmail.com>\nSuggested-by: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: mm/zsmalloc: avoid duplicate assignment of prev_class\n\n(cherry-pick from commit df8b5bb998f10cfc040ad30300f9a9ea4592ff82)\n\nIn zs_create_pool(), prev_class is assigned (ZS_SIZE_CLASSES - 1) times.\nAnd the prev_class only references to the previous size_class.  So we do\nnot need unnecessary assignement.\n\nThis patch assigns *prev_class* when a new size_class structure is\nallocated and uses prev_class to check whether the first class has been\nallocated.\n\nBug: 25951511\n\nChange-Id: Ie5e4be867976af0e9ce786a58d1ee0147b7fb0ad\n[akpm@linux-foundation.org: remove now-unused ZS_SIZE_CLASSES]\nSigned-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>\nCc: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nReviewed-by: Dan Streetman <ddstreet@ieee.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: mm/zsmalloc: allocate exactly size of struct zs_pool\n\n(cherry-pick from commit 181366561ac1e1a7bc3b91dbe45e7614a2f758b9)\n\nIn zs_create_pool(), we allocate memory more then sizeof(struct zs_pool)\n  ovhd_size = roundup(sizeof(*pool), PAGE_SIZE);\n\nThis patch allocate memory of exactly needed size.\n\nBug: 25951511\n\nChange-Id: Iae1216f7ab304164ea7d687e0037574d6738c94e\nSigned-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>\nAcked-by: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Dan Streetman <ddstreet@ieee.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nBACKPORT: mm/zsmalloc: adjust order of functions\n\n(cherry-pick from commit 66cdef663cd7a97aff6bbbf41a81a0205dc81ba2)\n\nCurrently functions in zsmalloc.c does not arranged in a readable and\nreasonable sequence.  With the more and more functions added, we may\nmeet below inconvenience.  For example:\n\nCurrent functions:\n\n    void zs_init()\n    {\n    }\n\n    static void get_maxobj_per_zspage()\n    {\n    }\n\nThen I want to add a func_1() which is called from zs_init(), and this\nnew added function func_1() will used get_maxobj_per_zspage() which is\ndefined below zs_init().\n\n    void func_1()\n    {\n        get_maxobj_per_zspage()\n    }\n\n    void zs_init()\n    {\n        func_1()\n    }\n\n    static void get_maxobj_per_zspage()\n    {\n    }\n\nThis will cause compiling issue. So we must add a declaration:\n\n    static void get_maxobj_per_zspage();\n\nbefore func_1() if we do not put get_maxobj_per_zspage() before\nfunc_1().\n\nIn addition, puting module_[init|exit] functions at the bottom of the\nfile conforms to our habit.\n\nSo, this patch ajusts function sequence as:\n\n    /* helper functions */\n    ...\n    obj_location_to_handle()\n    ...\n\n    /* Some exported functions */\n    ...\n\n    zs_map_object()\n    zs_unmap_object()\n\n    zs_malloc()\n    zs_free()\n\n    zs_init()\n    zs_exit()\n\nBug: 25951511\n\nChange-Id: I68377a213ade041b34e99a4280ebd57a933dfa83\nSigned-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>\nCc: Nitin Gupta <ngupta@vflare.org>\nAcked-by: Minchan Kim <minchan@kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nBACKPORT: mm/zpool: add name argument to create zpool\n\n(cherry-pick from commit 3eba0c6a56c04f2b017b43641a821f1ebfb7fb4c)\n\nCurrently the underlay of zpool: zsmalloc/zbud, do not know who creates\nthem.  There is not a method to let zsmalloc/zbud find which caller they\nbelong to.\n\nNow we want to add statistics collection in zsmalloc.  We need to name the\ndebugfs dir for each pool created.  The way suggested by Minchan Kim is to\nuse a name passed by caller(such as zram) to create the zsmalloc pool.\n\n    /sys/kernel/debug/zsmalloc/zram0\n\nThis patch adds an argument `name' to zs_create_pool() and other related\nfunctions.\n\nBug: 25951511\n\nChange-Id: Ib71e8e63c71e808795073bd08c0aab14b43b4c35\nSigned-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>\nAcked-by: Minchan Kim <minchan@kernel.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Dan Streetman <ddstreet@ieee.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nBACKPORT: mm/zsmalloc: add statistics support\n\n(cherry-pick from commit 0f050d997e275cf0e47ddc7006284eaa3c6fe049)\n\nKeeping fragmentation of zsmalloc in a low level is our target.  But now\nwe still need to add the debug code in zsmalloc to get the quantitative\ndata.\n\nThis patch adds a new configuration CONFIG_ZSMALLOC_STAT to enable the\nstatistics collection for developers.  Currently only the objects\nstatatitics in each class are collected.  User can get the information via\ndebugfs.\n\n     cat /sys/kernel/debug/zsmalloc/zram0/...\n\nFor example:\n\nAfter I copied \"jdk-8u25-linux-x64.tar.gz\" to zram with ext4 filesystem:\n class  size obj_allocated   obj_used pages_used\n     0    32             0          0          0\n     1    48           256         12          3\n     2    64            64         14          1\n     3    80            51          7          1\n     4    96           128          5          3\n     5   112            73          5          2\n     6   128            32          4          1\n     7   144             0          0          0\n     8   160             0          0          0\n     9   176             0          0          0\n    10   192             0          0          0\n    11   208             0          0          0\n    12   224             0          0          0\n    13   240             0          0          0\n    14   256            16          1          1\n    15   272            15          9          1\n    16   288             0          0          0\n    17   304             0          0          0\n    18   320             0          0          0\n    19   336             0          0          0\n    20   352             0          0          0\n    21   368             0          0          0\n    22   384             0          0          0\n    23   400             0          0          0\n    24   416             0          0          0\n    25   432             0          0          0\n    26   448             0          0          0\n    27   464             0          0          0\n    28   480             0          0          0\n    29   496            33          1          4\n    30   512             0          0          0\n    31   528             0          0          0\n    32   544             0          0          0\n    33   560             0          0          0\n    34   576             0          0          0\n    35   592             0          0          0\n    36   608             0          0          0\n    37   624             0          0          0\n    38   640             0          0          0\n    40   672             0          0          0\n    42   704             0          0          0\n    43   720            17          1          3\n    44   736             0          0          0\n    46   768             0          0          0\n    49   816             0          0          0\n    51   848             0          0          0\n    52   864            14          1          3\n    54   896             0          0          0\n    57   944            13          1          3\n    58   960             0          0          0\n    62  1024             4          1          1\n    66  1088            15          2          4\n    67  1104             0          0          0\n    71  1168             0          0          0\n    74  1216             0          0          0\n    76  1248             0          0          0\n    83  1360             3          1          1\n    91  1488            11          1          4\n    94  1536             0          0          0\n   100  1632             5          1          2\n   107  1744             0          0          0\n   111  1808             9          1          4\n   126  2048             4          4          2\n   144  2336             7          3          4\n   151  2448             0          0          0\n   168  2720            15         15         10\n   190  3072            28         27         21\n   202  3264             0          0          0\n   254  4096         36209      36209      36209\n\n Total               37022      36326      36288\n\nWe can calculate the overall fragentation by the last line:\n    Total               37022      36326      36288\n    (37022 - 36326) / 37022 = 1.87%\n\nAlso by analysing objects alocated in every class we know why we got so\nlow fragmentation: Most of the allocated objects is in <class 254>.  And\nthere is only 1 page in class 254 zspage.  So, No fragmentation will be\nintroduced by allocating objs in class 254.\n\nAnd in future, we can collect other zsmalloc statistics as we need and\nanalyse them.\n\nBug: 25951511\n\nChange-Id: I117604ad5fec8be5c10810ea93049140fd51f80b\nSigned-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>\nSuggested-by: Minchan Kim <minchan@kernel.org>\nAcked-by: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nCc: Dan Streetman <ddstreet@ieee.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: decouple handle and object\n\n(cherry-pick from commit 2e40e163a25af3bd35d128d3e2e005916de5cce6)\n\nRecently, we started to use zram heavily and some of issues\npopped.\n\n1) external fragmentation\n\nI got a report from Juneho Choi that fork failed although there are plenty\nof free pages in the system.  His investigation revealed zram is one of\nthe culprit to make heavy fragmentation so there was no more contiguous\n16K page for pgd to fork in the ARM.\n\n2) non-movable pages\n\nOther problem of zram now is that inherently, user want to use zram as\nswap in small memory system so they use zRAM with CMA to use memory\nefficiently.  However, unfortunately, it doesn't work well because zRAM\ncannot use CMA's movable pages unless it doesn't support compaction.  I\ngot several reports about that OOM happened with zram although there are\nlots of swap space and free space in CMA area.\n\n3) internal fragmentation\n\nzRAM has started support memory limitation feature to limit memory usage\nand I sent a patchset(https://lkml.org/lkml/2014/9/21/148) for VM to be\nharmonized with zram-swap to stop anonymous page reclaim if zram consumed\nmemory up to the limit although there are free space on the swap.  One\nproblem for that direction is zram has no way to know any hole in memory\nspace zsmalloc allocated by internal fragmentation so zram would regard\nswap is full although there are free space in zsmalloc.  For solving the\nissue, zram want to trigger compaction of zsmalloc before it decides full\nor not.\n\nThis patchset is first step to support above issues.  For that, it adds\nindirect layer between handle and object location and supports manual\ncompaction to solve 3th problem first of all.\n\nAfter this patchset got merged, next step is to make VM aware of zsmalloc\ncompaction so that generic compaction will move zsmalloced-pages\nautomatically in runtime.\n\nIn my imaginary experiment(ie, high compress ratio data with heavy swap\nin/out on 8G zram-swap), data is as follows,\n\nBefore =\nzram allocated object :      60212066 bytes\nzram total used:     140103680 bytes\nratio:         42.98 percent\nMemFree:          840192 kB\n\nCompaction\n\nAfter =\nfrag ratio after compaction\nzram allocated object :      60212066 bytes\nzram total used:      76185600 bytes\nratio:         79.03 percent\nMemFree:          901932 kB\n\nJuneho reported below in his real platform with small aging.\nSo, I think the benefit would be bigger in real aging system\nfor a long time.\n\n- frag_ratio increased 3% (ie, higher is better)\n- memfree increased about 6MB\n- In buddy info, Normal 2^3: 4, 2^2: 1: 2^1 increased, Highmem: 2^1 21 increased\n\nfrag ratio after swap fragment\nused :        156677 kbytes\ntotal:        166092 kbytes\nfrag_ratio :  94\nmeminfo before compaction\nMemFree:           83724 kB\nNode 0, zone   Normal  13642   1364     57     10     61     17      9      5      4      0      0\nNode 0, zone  HighMem    425     29      1      0      0      0      0      0      0      0      0\n\nnum_migrated :  23630\ncompaction done\n\nfrag ratio after compaction\nused :        156673 kbytes\ntotal:        160564 kbytes\nfrag_ratio :  97\nmeminfo after compaction\nMemFree:           89060 kB\nNode 0, zone   Normal  14076   1544     67     14     61     17      9      5      4      0      0\nNode 0, zone  HighMem    863     50      1      0      0      0      0      0      0      0      0\n\nThis patchset adds more logics(about 480 lines) in zsmalloc but when I\ntested heavy swapin/out program, the regression for swapin/out speed is\nmarginal because most of overheads were caused by compress/decompress and\nother MM reclaim stuff.\n\nThis patch (of 7):\n\nCurrently, handle of zsmalloc encodes object's location directly so it\nmakes support of migration hard.\n\nThis patch decouples handle and object via adding indirect layer.  For\nthat, it allocates handle dynamically and returns it to user.  The handle\nis the address allocated by slab allocation so it's unique and we could\nkeep object's location in the memory space allocated for handle.\n\nWith it, we can change object's position without changing handle itself.\n\nBug: 25951511\n\nChange-Id: Id50a98341f63c4e1bb39589ca992661486469dca\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nCc: Juneho Choi <juno.choi@lge.com>\nCc: Gunho Lee <gunho.lee@lge.com>\nCc: Luigi Semenzato <semenzato@google.com>\nCc: Dan Streetman <ddstreet@ieee.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Joonsoo Kim <iamjoonsoo.kim@lge.com>\nCc: Mel Gorman <mel@csn.ul.ie>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: factor out obj_[malloc|free]\n\n(cherry-pick from commit c78062612fb525430b775a0bef4d3cc07e512da0)\n\nIn later patch, migration needs some part of functions in zs_malloc and\nzs_free so this patch factor out them.\n\nBug: 25951511\n\nChange-Id: I6079cbc1d3d107bc39f9dbb3412d9eb9039875ad\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nCc: Juneho Choi <juno.choi@lge.com>\nCc: Gunho Lee <gunho.lee@lge.com>\nCc: Luigi Semenzato <semenzato@google.com>\nCc: Dan Streetman <ddstreet@ieee.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Joonsoo Kim <iamjoonsoo.kim@lge.com>\nCc: Mel Gorman <mel@csn.ul.ie>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: support compaction\n\n(cherry-pick from commit 312fcae227037619dc858c9ccd362c7b847730a2)\n\nThis patch provides core functions for migration of zsmalloc.  Migraion\npolicy is simple as follows.\n\nfor each size class {\n        while {\n                src_page = get zs_page from ZS_ALMOST_EMPTY\n                if (!src_page)\n                        break;\n                dst_page = get zs_page from ZS_ALMOST_FULL\n                if (!dst_page)\n                        dst_page = get zs_page from ZS_ALMOST_EMPTY\n                if (!dst_page)\n                        break;\n                migrate(from src_page, to dst_page);\n        }\n}\n\nFor migration, we need to identify which objects in zspage are allocated\nto migrate them out.  We could know it by iterating of freed objects in a\nzspage because first_page of zspage keeps free objects singly-linked list\nbut it's not efficient.  Instead, this patch adds a tag(ie,\nOBJ_ALLOCATED_TAG) in header of each object(ie, handle) so we could check\nwhether the object is allocated easily.\n\nThis patch adds another status bit in handle to synchronize between user\naccess through zs_map_object and migration.  During migration, we cannot\nmove objects user are using due to data coherency between old object and\nnew object.\n\nBug: 25951511\n\nChange-Id: Ideb5295570cc1f6c4fcb18a8f8609c63a38c86e4\n[akpm@linux-foundation.org: zsmalloc.c needs sched.h for cond_resched()]\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nCc: Juneho Choi <juno.choi@lge.com>\nCc: Gunho Lee <gunho.lee@lge.com>\nCc: Luigi Semenzato <semenzato@google.com>\nCc: Dan Streetman <ddstreet@ieee.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Joonsoo Kim <iamjoonsoo.kim@lge.com>\nCc: Mel Gorman <mel@csn.ul.ie>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: adjust ZS_ALMOST_FULL\n\n(cherry-pick from commit d3d07c92ff69f784bb8c3279fa87678bfa2f7f6f)\n\nCurretly, zsmalloc regards a zspage as ZS_ALMOST_EMPTY if the zspage has\nunder 1/4 used objects(ie, fullness_threshold_frac).  It could make result\nin loose packing since zsmalloc migrates only ZS_ALMOST_EMPTY zspage out.\n\nThis patch changes the rule so that zsmalloc makes zspage which has above\n3/4 used object ZS_ALMOST_FULL so it could make tight packing.\n\nBug: 25951511\n\nChange-Id: I9283cd6e8ce9916ea7213b724946664e2a6f32cb\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nCc: Juneho Choi <juno.choi@lge.com>\nCc: Gunho Lee <gunho.lee@lge.com>\nCc: Luigi Semenzato <semenzato@google.com>\nCc: Dan Streetman <ddstreet@ieee.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Joonsoo Kim <iamjoonsoo.kim@lge.com>\nCc: Mel Gorman <mel@csn.ul.ie>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: record handle in page->private for huge object\n\n(cherry-pick from commit 7b60a68529b0d827d26ea3426c2addd071bff789)\n\nWe store handle on header of each allocated object so it increases the\nsize of each object by sizeof(unsigned long).\n\nIf zram stores 4096 bytes to zsmalloc(ie, bad compression), zsmalloc needs\n4104B-class to add handle.\n\nHowever, 4104B-class has 1-pages_per_zspage so wasted size by internal\nfragment is 8192 - 4104, which is terrible.\n\nSo this patch records the handle in page->private on such huge object(ie,\npages_per_zspage == 1 && maxobj_per_zspage == 1) instead of header of each\nobject so we could use 4096B-class, not 4104B-class.\n\nBug: 25951511\n\nChange-Id: I392eed4a0e0db5a940bc8a97ef56c26a7397b0f9\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nCc: Juneho Choi <juno.choi@lge.com>\nCc: Gunho Lee <gunho.lee@lge.com>\nCc: Luigi Semenzato <semenzato@google.com>\nCc: Dan Streetman <ddstreet@ieee.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Joonsoo Kim <iamjoonsoo.kim@lge.com>\nCc: Mel Gorman <mel@csn.ul.ie>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: add fullness into stat\n\n(cherry-pick from commit 248ca1b053c82fa22427d22b33ac51a24c88a86d)\n\nDuring investigating compaction, fullness information of each class is\nhelpful for investigating how the compaction works well.  With that, we\ncould know how compaction works well more clear on each size class.\n\nBug: 25951511\n\nChange-Id: Idc07b265d005b680abb55b7dc61341a3de43a62c\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nCc: Juneho Choi <juno.choi@lge.com>\nCc: Gunho Lee <gunho.lee@lge.com>\nCc: Luigi Semenzato <semenzato@google.com>\nCc: Dan Streetman <ddstreet@ieee.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Joonsoo Kim <iamjoonsoo.kim@lge.com>\nCc: Mel Gorman <mel@csn.ul.ie>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: zsmalloc documentation\n\n(cherry-pick from commit d02be50dba649b4246e0c1c4b7cb5d8a8d49de9a)\n\nCreate zsmalloc doc which explains design concept and stat information.\n\nBug: 25951511\n\nChange-Id: Ie1e5ac914186558feabaf8fbea29154395267dda\nSigned-off-by: Minchan Kim <minchan@kernel.org>\nCc: Juneho Choi <juno.choi@lge.com>\nCc: Gunho Lee <gunho.lee@lge.com>\nCc: Luigi Semenzato <semenzato@google.com>\nCc: Dan Streetman <ddstreet@ieee.org>\nCc: Seth Jennings <sjennings@variantweb.net>\nCc: Nitin Gupta <ngupta@vflare.org>\nCc: Jerome Marchand <jmarchan@redhat.com>\nCc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nCc: Joonsoo Kim <iamjoonsoo.kim@lge.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: mm/zsmalloc.c: fix comment for get_pages_per_zspage\n\n(cherry-pick from commit 888fa374e625f3ee8f3cc2efebf52939d3bb6da1)\n\nBug: 25951511\n\nChange-Id: I94fc95aff6dcab3999c3dcb275ca65b8cd4b3565\nSigned-off-by: Yinghao Xie <yinghao.xie@sumsung.com>\nSuggested-by: Minchan Kim <minchan@kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: remove synchronize_rcu from zs_compact()\n\n(cherry-pick from commit 1ec7cfb13acb8047ae5baafb43d2cd6b64ac85b9)\n\nDo not synchronize rcu in zs_compact(). Neither zsmalloc not\nzram use rcu.\n\nBug: 25951511\n\nChange-Id: I2f2d1a81dac561ddfabb861bedcbb1ba773f207f\nSigned-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nAcked-by: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: micro-optimize zs_object_copy()\n\n(cherry-pick from commit 495819ead5ad02174208994ca610852a7791a2f2)\n\nA micro-optimization.  Avoid additional branching and reduce (a bit)\nregistry pressure (f.e.  s_off += size; d_off += size; may be calculated\ntwise: first for >= PAGE_SIZE check and later for offset update in \"else\"\nclause).\n\nscripts/bloat-o-meter shows some improvement\n\nadd/remove: 0/0 grow/shrink: 0/1 up/down: 0/-10 (-10)\nfunction                          old     new   delta\nzs_object_copy                    550     540     -10\n\nBug: 25951511\n\nChange-Id: Ie3255d79246493fc755e6256f12082e692c0fc3c\nSigned-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\nAcked-by: Minchan Kim <minchan@kernel.org>\nCc: Nitin Gupta <ngupta@vflare.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nUPSTREAM: zsmalloc: remove unnecessary insertion/removal of zspage in com…","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/dcac9912d38bc060f09ba753f32b6d365b92275d"},{"sha":"0380cf01baaf9edbffcb2cb10a69cf79f52c957e","author":{"name":"Pradeep Sawlani","email":"0053a3cee00cfcd87fa2079fd7efacb8a5744ad0@amazon.com"},"message":"ksm: check and skip page, if it is already scanned\n\nOn system like Android where most of the process are forked\nfrom parent w/o execve, KSM can scan same page multiple times\nin one scan cycle. There is no advantage in scanning same page\nmultiple times for merging. During testing with Android, it was\nobserved around 60% pages are skipped for each scan cycle.\n\nChange-Id: I0cf01802f0b4d61fcab92558beb9e1c660dc9a77\nLink: http://lkml.kernel.org/r/CAMrOTPgBtANS_ryRjan0-dTL97U7eRvtf3dCsss=Kn+Uk89fuA@mail.gmail.com\nSigned-off-by: Pradeep Sawlani <sawlani@amazon.com>","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/0380cf01baaf9edbffcb2cb10a69cf79f52c957e"},{"sha":"993ff1f47771792d270e5590d0457ed39998beed","author":{"name":"Greg Kroah-Hartman","email":"4931344b09d7a7d3573e8b1ebec918e229ead9bf@google.com"},"message":"ak_angler_defconfig: disable CONFIG_PFT as it is unsupported\n\nDisable the drivers/platform/msm/pft.c driver as it is unsupported by\nQualcomm, and opens us up to a wide range of potential attack surfaces\nthat has not been audited by anyone.\n\nQualcomm recommends that it be disabled, as it hooks into SELinux in\nsome \"interesting\" ways, and the userspace portion of the code is not\neven part of the image.\n\nBug: 28588434\nChange-Id: I7fb1258839db984b34074bb53a0174d63393d728\nQualcomm-case-number: 02440206\nSigned-off-by: Greg Kroah-Hartman gregkh@google.com","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/993ff1f47771792d270e5590d0457ed39998beed"},{"sha":"d4968aba2436d1223fa78cb2b3b9b2beccf0c667","author":{"name":"Nathan Chancellor","email":"b2febe722de126fdca89e2e24ca48c984e7dc9fc@gmail.com"},"message":"Make BIG cluster's minimum frequency 302MHz","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/d4968aba2436d1223fa78cb2b3b9b2beccf0c667"},{"sha":"1ea8f85d22ec56ef79906b9346d89ca035822eea","author":{"name":"JC","email":"7b2e9f54cdff413fcde01f330af6896c3cd7e6cd@whompify.com"},"message":"archi and engstk cflags","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/1ea8f85d22ec56ef79906b9346d89ca035822eea"},{"sha":"33452416b6bad4f3286133ed31f67e5a86d87fed","author":{"name":"Venkatesh Yadav Abbarapu","email":"10fd0ea5b25cf2d1331345f1fb89c1552666bcf8@codeaurora.org"},"message":"crypto: msm: fix qcrypto driver to improve IPSec performance\n\nThis patch introduces a workqueue which makes all completion\ncallbacks back to the network stack. This workqueue is bound\nto the CPU which receives IRQs from CE 1. The done_tasklet\nbeing scheduled after completion of each CE request has been\nreplaced with a mere function call that configures the CE for\nthe next request. Flow control logic implemented restricts\ncompletion callbacks from exceeding a backlog threshold to prevent\nthe kernel from running out of memory.\n\nChange-Id: I6d90913cb5f8e567288ca524808ef4afc34ab8cb\nAcked-by: John Nicholas <jnichola@qti.qualcomm.com>\nSigned-off-by: Venkatesh Yadav Abbarapu <quicvenkat@codeaurora.org>","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/33452416b6bad4f3286133ed31f67e5a86d87fed"},{"sha":"974dc315c08a6211b86ca7b8d3d0a83cace34647","author":{"name":"Zhen Kong","email":"b999fb1d59364862997bac94d5b793be36d63b01@codeaurora.org"},"message":"crypto: msm: remove wakeup lock in qcrypto driver\n\nWhen log server still runs and try to enable CE clock just before sleep,\nwakeup lock will prevent the device sleep. And the bam/crypto is a not a\nwakeupable device. As we have a state machine in crypto driver, and it\nis able to control suspend behavior well, we do not need to use wakeup\nlock in qcrypto driver.\n\nChange-Id: I660818ec6fad4051db08c10a76d5d1b408bece7e\nSigned-off-by: Zhen Kong <zkong@codeaurora.org>","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/974dc315c08a6211b86ca7b8d3d0a83cace34647"},{"sha":"295953591b15ecdf9d1c04fd717b76a011980387","author":{"name":"Kranthikumar Kurapati","email":"916bebc6e54aba9df8f53f35d9454122758ae7b3@codeaurora.org"},"message":"crypto: msm: qcrypto: Fix spinlock deadlock issue\n\nDisable and then enable bottom half processing across completion callback.\nOtherwise spinlock deadlock may happen.\n\nChange-Id: I1d38a9b978d6a3b72c820fb8c5ccc27e7afc06a3\nAcked-by: Che-Min Hsieh <cheminh@qti.qualcomm.com>\nSigned-off-by: Kranthikumar Kurapati <kkurap@codeaurora.org>","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/295953591b15ecdf9d1c04fd717b76a011980387"},{"sha":"5372532a6d26a16046ebb921c246355c8c692410","author":{"name":"Kranthikumar Kurapati","email":"916bebc6e54aba9df8f53f35d9454122758ae7b3@codeaurora.org"},"message":"crypto: msm: qcrypto: Provide fallback for aead aes192\n\nCrypto 5 HW does not provide aes 192 function. aes 192 fallback function\nhas been in place. The fallback for authenc(hmac(sha256),cbc(aes)) and\nauthenc(hmac(sha1),cbc(aes)) are provided now in the qcrypto driver.\n\nChange-Id: I2c61b6df12f3a4b40e0e13170a803c44270db5cf\nAcked-by: Che-Min Hsieh <cheminh@qti.qualcomm.com>\nSigned-off-by: Kranthikumar Kurapati <kkurap@codeaurora.org>","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/5372532a6d26a16046ebb921c246355c8c692410"},{"sha":"c412d48d19b2b05bb805d1e90c05a3351b0716c3","author":{"name":"Sivanesan Rajapupathi","email":"5b8835fd513552ead6e01f1ac89e81c1d3d2d225@codeaurora.org"},"message":"crypto: msm: qcrypto: Fix hash crash if not last issue\n\nIf an ahash request is not final, the result variable of ahash_request\nmay not exist. In the completion callback function, then, do not\ncopy the digest result to result variable of ahash_request, if it not\nfinal.  Otherwise, crash may happen.\n\nChange-Id: I169218e8658500539b19408eca3afeabcaa4816b\nAcked-by: Che-Min Hsieh <cheminh@qti.qualcomm.com>\nSigned-off-by: Sivanesan Rajapupathi <srajap@codeaurora.org>","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/c412d48d19b2b05bb805d1e90c05a3351b0716c3"},{"sha":"7204cc13dbc3eb720591816be9ecad500b610296","author":{"name":"Dennis Rassmann","email":"f295a9b92dc83b2b74ebe01c45996e3106890c37@gmail.com"},"message":"Angler: Add Bricked_hotplug driver\n\nChange-Id: I141eb49d28fa5e48258b9b31990d440c44c505b0\n\nbricked_hotplug: Modifications for the hexacore architecture\n\nBasically extended threshold arrays (originally designed for quad core CPUs) and implemented\na quick hack to shut down BIG cores first on MSM_MPDEC_DOWN events.\n\nChange-Id: I475aa817ada9e430eb02a2e0ed86468325b95a33\n\nbricked_hotplug: Plug/unplug threshold tuning\n\nChange-Id: Idf295e5f137cd5ac869882987fe222631b413759\n\nbricked_hotplug: Fix bug when max_cpu_online_susp is set to 1 when screen is off\n\nChange-Id: I7de93ef127f6a045e21664e2e1b351db30808441\n\nbricked_hotplug: Configure for Angler (8 cores)\n\nChange-Id: I22fe29404ec9a79a60114e8659445b843f0aa0f5\n\nAngler: Enable bricked hotplug by default and set default scroff cores to 2\n\nChange-Id: Ib5b58d9599b289f7c55ae92c343bdf487d9e2e1e\n\ndefconfig: enable bricked_hotplug\n\nChange-Id: Icd1c00f792b5733ca646bfa085f7191ff344f897\n\nConflicts:\n\tarch/arm64/configs/angler_defconfig\n\nbricked hotplug: change defaults\n\nChange-Id: If08de990b3bcd4ab4dd99f32e3ab0f5fba1080e3","distinct":true,"url":"https://api.github.com/repos/kogone/AK-Angler/commits/7204cc13dbc3eb720591816be9ecad500b610296"}]}
{"actor":{"display_login":"kogone"}}