android_kernel_samsung_a7y1.../drivers/block
carck a595e5ffcc zram: try to avoid worst-case scenario on same element pages
The worst-case scenario on finding same element pages is that almost all elements are same at the first glance but only last few elements are different.
Since the same element tends to be grouped from the beginning of the
pages, if we check the first element with the last element before
looping through all elements, we might have some chances to quickly
detect non-same element pages.

 1. Test is done under LG webOS TV (64-bit arch)
 2. Dump the swap-out pages (~819200 pages)
 3. Analyze the pages with simple test script which counts the iteration
    number and measures the speed at off-line

Under 64-bit arch, the worst iteration count is PAGE_SIZE / 8 bytes =
512.  The speed is based on the time to consume page_same_filled()
function only.  The result, on average, is listed as below:

                                     Num of Iter    Speed(MB/s)
  Looping-Forward (Orig)                 38            99265
  Looping-Backward                       36           102725
  Last-element-check (This Patch)        33           125072

The result shows that the average iteration count decreases by 13% and
the speed increases by 25% with this patch.  This patch does not
increase the overall time complexity, though.

I also ran simpler version which uses backward loop.  Just looping
backward also makes some improvement, but less than this patch.

[taejoon.song@lge.com: fix off-by-one]
  Link: http://lkml.kernel.org/r/1578642001-11765-1-git-send-email-taejoon.song@lge.com
Link: http://lkml.kernel.org/r/1575424418-16119-1-git-send-email-taejoon.song@lge.com
Signed-off-by: Taejoon Song <taejoon.song@lge.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-08-19 11:34:40 +05:30
..
aoe A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
drbd signal: Allow cifs and drbd to receive their terminating signals 2020-04-07 13:42:54 +02:00
mtip32xx A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
paride A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rsxx rsxx: add missed destroy_workqueue calls in remove 2020-04-07 12:44:10 +02:00
xen-blkback A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
zram zram: try to avoid worst-case scenario on same element pages 2020-08-19 11:34:40 +05:30
amiflop.c amiflop: clean up on errors during setup 2020-04-07 12:34:38 +02:00
ataflop.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
brd.c brd: check and limit max_part par 2020-04-07 13:57:30 +02:00
cciss_cmd.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cciss_scsi.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cciss_scsi.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cciss.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cciss.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cpqarray.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cpqarray.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cryptoloop.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
DAC960.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
DAC960.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
floppy.c floppy: check FDC index for errors before assigning it 2020-04-07 14:01:14 +02:00
hd.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ida_cmd.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ida_ioctl.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
loop.c loop: Add LOOP_SET_DIRECT_IO to compat ioctl 2020-04-07 09:25:58 +02:00
loop.h Revert "block/loop: Use global lock for ioctl() operation." 2020-04-06 16:40:42 +02:00
Makefile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mg_disk.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
nbd.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
null_blk.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
osdblk.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
pktcdvd.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ps3disk.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ps3vram.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rbd_types.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rbd.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
skd_main.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
skd_s1120.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
smart1,2.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sunvdc.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
swim_asm.S A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
swim.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
swim3.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sx8.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
umem.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
umem.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
virtio_blk.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
xen-blkfront.c xen/blkfront: Adjust indentation in xlvbd_alloc_gendisk 2020-04-07 13:38:45 +02:00
xsysace.c xsysace: Fix error handling in ace_setup 2020-04-06 16:42:28 +02:00
z2ram.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30