New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 721934 link

Starred by 2 users

Issue metadata

Status: Archived
Owner:
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug

Blocked on:
issue 721955


Show other hotlists

Hotlists containing this issue:
Hotlist-2


Sign in to add a comment

Backport / test "same page" optimization to zram

Project Member Reported by diand...@chromium.org, May 12 2017

Issue description

Upstream zram has a commit:

commit 8e19d540d107ee897eb9a874844060c94e2376c0
Author:     zhouxianrong <zhouxianrong@huawei.com>
AuthorDate: Fri Feb 24 14:59:27 2017 -0800
Commit:     Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Fri Feb 24 17:46:56 2017 -0800

    zram: extend zero pages to same element pages

---

This commit looks to give a non-zero improvement in the amount of memory we can compress.  We should probably take it.
 
Blockedon: 721955
Here they are.  Would be interesting to do tab switching tests with these to see if there is any improvement?

remote:   https://chromium-review.googlesource.com/505202 UPSTREAM: zram: remove obsolete sysfs attrs        
remote:   https://chromium-review.googlesource.com/505203 BACKPORT: zram: extend zero pages to same element pages        
remote:   https://chromium-review.googlesource.com/505204 UPSTREAM: zram: reduce load operation in page_same_filled        

This is blocked on  bug #721955  now, however.  I could avoid the blocker but then I'd have to do more of a backport.  It seems best to just fix the other bug.
Status: Started (was: Available)
FYI that I hacked in tracking of zero vs. same pages and then ran the "typical 25" tab switching test.  AKA:

  ./run_benchmark \
    --browser=cros-chrome \
    --remote=da2 \
    tab_switching.typical_25 \
    --also-run-disabled-tests \
    --tabset-repeat=5

That test was having problems, but it still managed to fill up memory.  One example sample was:

same pages (including zero): 19725
zero pages:                  19001


Not exactly stupendous, but I guess we can take what we get...  Maybe other workloads will benefit more?  Presumably if you have an uncompressed bitmap that's big enough and a solid color, you might have a "same page".  Not sure when else you might...

===

Three patches are:

https://chromium-review.googlesource.com/c/505202/
https://chromium-review.googlesource.com/c/505203/
https://chromium-review.googlesource.com/c/505204/


Hack for printouts is at:

https://chromium-review.googlesource.com/c/508280

===

For 3.18, we get a free documentation update and a bugfix to go with it...

remote:   https://chromium-review.googlesource.com/508042 UPSTREAM: zram: update documentation        
remote:   https://chromium-review.googlesource.com/508043 UPSTREAM: zram: remove obsolete sysfs attrs        
remote:   https://chromium-review.googlesource.com/508044 BACKPORT: zram: do not use copy_page with non-page aligned address        
remote:   https://chromium-review.googlesource.com/508045 BACKPORT: zram: extend zero pages to same element pages        
remote:   https://chromium-review.googlesource.com/508046 UPSTREAM: zram: reduce load operation in page_same_filled        



#2 you're saying that this improves the compression by 3.6% times fraction of zero pages?  In a quick experiment, I am seeing 10% to 15% zero pages (although I have some old memory dumps where it's only 5%) so this is at best a 0.5% improvement in compression.  And what's the cost?

Ah I see---no extra CPU cost, because comparing to zero costs the same as comparing to the first 32-bit word in the page.

And no extra storage cost thanks to this:

/* Allocated for each disk page */
struct zram_table_entry {
	union {
		unsigned long handle;
		unsigned long element;
	};
	unsigned long value;
};

"element" is the "same" value.

I'm not 100% sure how much additional space / speed we gain from this.  Generally we should save this much memory:

  num-same-but-nonzero-pages * 
  (compressed size of a page of page of all zero + zsmalloc overhead)

That's probably not much.  I tried running 'gzip' on a 4K test.bin on my desktop and I found that it was 47 bytes big.  No idea if lzo would be similar, but maybe?  Maybe zsmalloc overhead is 16 bytes or something?  So maybe in the above we'd save 64 bytes * 724 = 45K.  Not much.  :-/

We presumably still get some speed savings, though, too.  We avoid the zsmalloc allocation and maybe even a kernel level memory allocation.  ...and we were already doing the same work to search for zero pages, so really the cost is that we need to do a "compare" instruction instead of a "test equal to zero" instruction.
Tested informally on 3.18 with Luigi.  We saw same be as much as 15%, like 10000 zero and 1500 same-but-not-zero.  In any case, landing these since there should be no downside and maybe some upside.
Project Member

Comment 7 by bugdroid1@chromium.org, May 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f69a6aae1e44f2a8d5acee4979eb109b4884b9ba

commit f69a6aae1e44f2a8d5acee4979eb109b4884b9ba
Author: kbr <kbr@chromium.org>
Date: Fri May 19 01:13:38 2017

Revert of Re-enable GPU watchdog for WebGL conformance tests. (patchset #1 id:1 of https://codereview.chromium.org/2887983002/ )

Reason for revert:
Unfortunately the GPU watchdog is still flakily firing, destabilizing these tests. See:
https://bugs.chromium.org/p/chromium/issues/detail?id=609252#c75

Original issue's description:
> Re-enable GPU watchdog for WebGL conformance tests.
>
> See whether this is working any more reliably now.
>
> BUG= 609252 
> CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
>
> Review-Url: https://codereview.chromium.org/2887983002
> Cr-Commit-Position: refs/heads/master@{#472378}
> Committed: https://chromium.googlesource.com/chromium/src/+/8f97866e8f0c1bae205fe0f3a4107d41ba8bae28

TBR=zmo@chromium.org
# Manually skipping Windows CQ tryservers because of unrelated failures.
NOTRY=true
BUG= 609252 

Review-Url: https://codereview.chromium.org/2894683003
Cr-Commit-Position: refs/heads/master@{#473009}

[modify] https://crrev.com/f69a6aae1e44f2a8d5acee4979eb109b4884b9ba/content/test/gpu/gpu_tests/webgl_conformance_integration_test.py

Project Member

Comment 8 by bugdroid1@chromium.org, May 19 2017

Labels: merge-merged-chromeos-4.4
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/796540fbee1a3a50170c93b2a7a02b095b0aa3ca

commit 796540fbee1a3a50170c93b2a7a02b095b0aa3ca
Author: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Date: Fri May 19 20:57:28 2017

UPSTREAM: zram: remove obsolete sysfs attrs

We had a deprecated_attr_warn() warning for 2 years and now the time has
come and we finally can do the cleanup.

The plan was as follows:

: per-stat sysfs attributes are considered to be deprecated.
: The basic strategy is:
: -- the existing RW nodes will be downgraded to WO nodes (in linux 4.11)
: -- deprecated RO sysfs nodes will eventually be removed (in linux 4.11)
:
: The list of deprecated attributes can be found here:
: Documentation/ABI/obsolete/sysfs-block-zram
:
: Basically, every attribute that has its own read accessible sysfs
: node (e.g. num_reads) *AND* is accessible via one of the stat files
: (zram<id>/stat or zram<id>/io_stat or zram<id>/mm_stat) is considered
: to be deprecated.

The patch also removes `obsolete/sysfs-block-zram', clean ups
`testing/sysfs-block-zram' and tweaks zram.txt files.

CQ-DEPEND=CL:506370
BUG= chromium:721934 ,  chromium:721955 
TEST=Build and boot

Change-Id: I1781db0293d9cc77c66f43ea84a0185c2b1bf5a4
Link: http://lkml.kernel.org/r/20170118035838.11090-1-sergey.senozhatsky@gmail.com
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from commit c87d1655c29500b459fb135258a93f8309ada9c7)
Reviewed-on: https://chromium-review.googlesource.com/505202
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>

[modify] https://crrev.com/796540fbee1a3a50170c93b2a7a02b095b0aa3ca/Documentation/ABI/testing/sysfs-block-zram
[modify] https://crrev.com/796540fbee1a3a50170c93b2a7a02b095b0aa3ca/drivers/block/zram/zram_drv.c
[delete] https://crrev.com/e0b7c547929a08ce67bfbc7c684b661489f69c14/Documentation/ABI/obsolete/sysfs-block-zram
[modify] https://crrev.com/796540fbee1a3a50170c93b2a7a02b095b0aa3ca/Documentation/blockdev/zram.txt

Project Member

Comment 9 by bugdroid1@chromium.org, May 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/796540fbee1a3a50170c93b2a7a02b095b0aa3ca

commit 796540fbee1a3a50170c93b2a7a02b095b0aa3ca
Author: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Date: Fri May 19 20:57:28 2017

UPSTREAM: zram: remove obsolete sysfs attrs

We had a deprecated_attr_warn() warning for 2 years and now the time has
come and we finally can do the cleanup.

The plan was as follows:

: per-stat sysfs attributes are considered to be deprecated.
: The basic strategy is:
: -- the existing RW nodes will be downgraded to WO nodes (in linux 4.11)
: -- deprecated RO sysfs nodes will eventually be removed (in linux 4.11)
:
: The list of deprecated attributes can be found here:
: Documentation/ABI/obsolete/sysfs-block-zram
:
: Basically, every attribute that has its own read accessible sysfs
: node (e.g. num_reads) *AND* is accessible via one of the stat files
: (zram<id>/stat or zram<id>/io_stat or zram<id>/mm_stat) is considered
: to be deprecated.

The patch also removes `obsolete/sysfs-block-zram', clean ups
`testing/sysfs-block-zram' and tweaks zram.txt files.

CQ-DEPEND=CL:506370
BUG= chromium:721934 ,  chromium:721955 
TEST=Build and boot

Change-Id: I1781db0293d9cc77c66f43ea84a0185c2b1bf5a4
Link: http://lkml.kernel.org/r/20170118035838.11090-1-sergey.senozhatsky@gmail.com
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from commit c87d1655c29500b459fb135258a93f8309ada9c7)
Reviewed-on: https://chromium-review.googlesource.com/505202
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>

[modify] https://crrev.com/796540fbee1a3a50170c93b2a7a02b095b0aa3ca/Documentation/ABI/testing/sysfs-block-zram
[modify] https://crrev.com/796540fbee1a3a50170c93b2a7a02b095b0aa3ca/drivers/block/zram/zram_drv.c
[delete] https://crrev.com/e0b7c547929a08ce67bfbc7c684b661489f69c14/Documentation/ABI/obsolete/sysfs-block-zram
[modify] https://crrev.com/796540fbee1a3a50170c93b2a7a02b095b0aa3ca/Documentation/blockdev/zram.txt

Project Member

Comment 10 by bugdroid1@chromium.org, May 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/142c518ea065579cd7a531e9ca6ed62bd84658b9

commit 142c518ea065579cd7a531e9ca6ed62bd84658b9
Author: zhouxianrong <zhouxianrong@huawei.com>
Date: Fri May 19 20:57:29 2017

BACKPORT: zram: extend zero pages to same element pages

The idea is that without doing more calculations we extend zero pages to
same element pages for zram.  zero page is special case of same element
page with zero element.

1. the test is done under android 7.0
2. startup too many applications circularly
3. sample the zero pages, same pages (none-zero element)
   and total pages in function page_zero_filled

the result is listed as below:

ZERO	SAME	TOTAL
36214	17842	598196

		ZERO/TOTAL	 SAME/TOTAL	  (ZERO+SAME)/TOTAL ZERO/SAME
AVERAGE	0.060631909	 0.024990816  0.085622726		2.663825038
STDEV	0.00674612	 0.005887625  0.009707034		2.115881328
MAX		0.069698422	 0.030046087  0.094975336		7.56043956
MIN		0.03959586	 0.007332205  0.056055193		1.928985507

from the above data, the benefit is about 2.5% and up to 3% of total
swapout pages.

The defect of the patch is that when we recovery a page from non-zero
element the operations are low efficient for partial read.

This patch extends zero_page to same_page so if there is any user to
have monitored zero_pages, he will be surprised if the number is
increased but it's not harmful, I believe.

BUG= chromium:721934 
TEST=`cat /sys/devices/virtual/block/zram0/mm_stat`, check 2nd to last entry

Conflicts:
	drivers/block/zram/zram_drv.c
Locally we have commit 9286385a3452 ("zram: do not use copy_page with
non-page aligned address") from linux stable.  The conlict was trivial
to resolve.

Change-Id: Ica1274d1709895903462f1bd1cf7125dbeadb5b1
[minchan@kernel.org: do not free same element pages in zram_meta_free]
  Link: http://lkml.kernel.org/r/20170207065741.GA2567@bbox
Link: http://lkml.kernel.org/r/1483692145-75357-1-git-send-email-zhouxianrong@huawei.com
Link: http://lkml.kernel.org/r/1486307804-27903-1-git-send-email-minchan@kernel.org
Signed-off-by: zhouxianrong <zhouxianrong@huawei.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from commit 8e19d540d107ee897eb9a874844060c94e2376c0)
Reviewed-on: https://chromium-review.googlesource.com/505203
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>

[modify] https://crrev.com/142c518ea065579cd7a531e9ca6ed62bd84658b9/drivers/block/zram/zram_drv.h
[modify] https://crrev.com/142c518ea065579cd7a531e9ca6ed62bd84658b9/drivers/block/zram/zram_drv.c
[modify] https://crrev.com/142c518ea065579cd7a531e9ca6ed62bd84658b9/Documentation/blockdev/zram.txt

Project Member

Comment 11 by bugdroid1@chromium.org, May 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/e0eb4e23d109f5462e345701dda998ed70b8a480

commit e0eb4e23d109f5462e345701dda998ed70b8a480
Author: Sangwoo Park <sangwoo2.park@lge.com>
Date: Fri May 19 20:57:30 2017

UPSTREAM: zram: reduce load operation in page_same_filled

In page_same_filled function, all elements in the page is compared with
next index value.  The current comparison routine compares the (i)th and
(i+1)th values of the page.

In this case, two load operaions occur for each comparison.  But if we
store first value of the page stores at 'val' variable and using it to
compare with others, the load opearation is reduced.  It reduce load
operation per page by up to 64times.

BUG= chromium:721934 
TEST=Build and boot

Change-Id: I0e9ddd2c2dbb4ec3ba39cd72310314fd4c465d89
Link: http://lkml.kernel.org/r/1488428104-7257-1-git-send-email-sangwoo2.park@lge.com
Signed-off-by: Sangwoo Park <sangwoo2.park@lge.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from commit f0fe9984656604ea8effd5ff82709ff8ce1f954b)
Reviewed-on: https://chromium-review.googlesource.com/505204
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>

[modify] https://crrev.com/e0eb4e23d109f5462e345701dda998ed70b8a480/drivers/block/zram/zram_drv.c

Project Member

Comment 12 by bugdroid1@chromium.org, May 19 2017

Labels: merge-merged-chromeos-3.18
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/3410a0f3409ad1df6841c80e0ebfc45c99b16b9c

commit 3410a0f3409ad1df6841c80e0ebfc45c99b16b9c
Author: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Date: Fri May 19 20:57:10 2017

UPSTREAM: zram: remove obsolete sysfs attrs

We had a deprecated_attr_warn() warning for 2 years and now the time has
come and we finally can do the cleanup.

The plan was as follows:

: per-stat sysfs attributes are considered to be deprecated.
: The basic strategy is:
: -- the existing RW nodes will be downgraded to WO nodes (in linux 4.11)
: -- deprecated RO sysfs nodes will eventually be removed (in linux 4.11)
:
: The list of deprecated attributes can be found here:
: Documentation/ABI/obsolete/sysfs-block-zram
:
: Basically, every attribute that has its own read accessible sysfs
: node (e.g. num_reads) *AND* is accessible via one of the stat files
: (zram<id>/stat or zram<id>/io_stat or zram<id>/mm_stat) is considered
: to be deprecated.

The patch also removes `obsolete/sysfs-block-zram', clean ups
`testing/sysfs-block-zram' and tweaks zram.txt files.

CQ-DEPEND=CL:506370
BUG= chromium:721934 ,  chromium:721955 
TEST=Build and boot

Change-Id: I1781db0293d9cc77c66f43ea84a0185c2b1bf5a4
Link: http://lkml.kernel.org/r/20170118035838.11090-1-sergey.senozhatsky@gmail.com
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from commit c87d1655c29500b459fb135258a93f8309ada9c7)
Reviewed-on: https://chromium-review.googlesource.com/508043
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>

[modify] https://crrev.com/3410a0f3409ad1df6841c80e0ebfc45c99b16b9c/Documentation/ABI/testing/sysfs-block-zram
[modify] https://crrev.com/3410a0f3409ad1df6841c80e0ebfc45c99b16b9c/drivers/block/zram/zram_drv.c
[delete] https://crrev.com/40219cf6230182338dc3daee1af441bd3a58f249/Documentation/ABI/obsolete/sysfs-block-zram
[modify] https://crrev.com/3410a0f3409ad1df6841c80e0ebfc45c99b16b9c/Documentation/blockdev/zram.txt

Project Member

Comment 13 by bugdroid1@chromium.org, May 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/cafbee7afcdae557ecd672be9ffb8ff854cb865d

commit cafbee7afcdae557ecd672be9ffb8ff854cb865d
Author: Minchan Kim <minchan@kernel.org>
Date: Fri May 19 20:57:11 2017

BACKPORT: zram: do not use copy_page with non-page aligned address

commit d72e9a7a93e4f8e9e52491921d99e0c8aa89eb4e upstream.

The copy_page is optimized memcpy for page-alinged address.  If it is
used with non-page aligned address, it can corrupt memory which means
system corruption.  With zram, it can happen with

1. 64K architecture
2. partial IO
3. slub debug

Partial IO need to allocate a page and zram allocates it via kmalloc.
With slub debug, kmalloc(PAGE_SIZE) doesn't return page-size aligned
address.  And finally, copy_page(mem, cmem) corrupts memory.

So, this patch changes it to memcpy.

Actuaully, we don't need to change zram_bvec_write part because zsmalloc
returns page-aligned address in case of PAGE_SIZE class but it's not
good to rely on the internal of zsmalloc.

Note:
 When this patch is merged to stable, clear_page should be fixed, too.
 Unfortunately, recent zram removes it by "same page merge" feature so
 it's hard to backport this patch to -stable tree.

I will handle it when I receive the mail from stable tree maintainer to
merge this patch to backport.

BUG= chromium:721934 
TEST=Build and boot

Change-Id: I5f876b8bf709d7c6669c7c48bc78eafc1ce66c61
Fixes: 42e99bd ("zram: optimize memory operations with clear_page()/copy_page()")
Link: http://lkml.kernel.org/r/1492042622-12074-2-git-send-email-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from linux-stable from 4.4
 commit 9286385a3452d7eeb01bfb94676389bba6f59ebd)
Reviewed-on: https://chromium-review.googlesource.com/508044
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>

[modify] https://crrev.com/cafbee7afcdae557ecd672be9ffb8ff854cb865d/drivers/block/zram/zram_drv.c

Project Member

Comment 14 by bugdroid1@chromium.org, May 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/2919014605f4689a63a26d264ff8e7f3cf19f344

commit 2919014605f4689a63a26d264ff8e7f3cf19f344
Author: zhouxianrong <zhouxianrong@huawei.com>
Date: Fri May 19 20:57:13 2017

BACKPORT: zram: extend zero pages to same element pages

The idea is that without doing more calculations we extend zero pages to
same element pages for zram.  zero page is special case of same element
page with zero element.

1. the test is done under android 7.0
2. startup too many applications circularly
3. sample the zero pages, same pages (none-zero element)
   and total pages in function page_zero_filled

the result is listed as below:

ZERO	SAME	TOTAL
36214	17842	598196

		ZERO/TOTAL	 SAME/TOTAL	  (ZERO+SAME)/TOTAL ZERO/SAME
AVERAGE	0.060631909	 0.024990816  0.085622726		2.663825038
STDEV	0.00674612	 0.005887625  0.009707034		2.115881328
MAX		0.069698422	 0.030046087  0.094975336		7.56043956
MIN		0.03959586	 0.007332205  0.056055193		1.928985507

from the above data, the benefit is about 2.5% and up to 3% of total
swapout pages.

The defect of the patch is that when we recovery a page from non-zero
element the operations are low efficient for partial read.

This patch extends zero_page to same_page so if there is any user to
have monitored zero_pages, he will be surprised if the number is
increased but it's not harmful, I believe.

BUG= chromium:721934 
TEST=`cat /sys/devices/virtual/block/zram0/mm_stat`, check 2nd to last entry

Conflicts:
	drivers/block/zram/zram_drv.c
Locally we have commit 9286385a3452 ("zram: do not use copy_page with
non-page aligned address") from linux stable.  The conlict was trivial
to resolve.

Change-Id: Ica1274d1709895903462f1bd1cf7125dbeadb5b1
[minchan@kernel.org: do not free same element pages in zram_meta_free]
  Link: http://lkml.kernel.org/r/20170207065741.GA2567@bbox
Link: http://lkml.kernel.org/r/1483692145-75357-1-git-send-email-zhouxianrong@huawei.com
Link: http://lkml.kernel.org/r/1486307804-27903-1-git-send-email-minchan@kernel.org
Signed-off-by: zhouxianrong <zhouxianrong@huawei.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from commit 8e19d540d107ee897eb9a874844060c94e2376c0)
Reviewed-on: https://chromium-review.googlesource.com/508045
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>

[modify] https://crrev.com/2919014605f4689a63a26d264ff8e7f3cf19f344/drivers/block/zram/zram_drv.h
[modify] https://crrev.com/2919014605f4689a63a26d264ff8e7f3cf19f344/drivers/block/zram/zram_drv.c
[modify] https://crrev.com/2919014605f4689a63a26d264ff8e7f3cf19f344/Documentation/blockdev/zram.txt

Project Member

Comment 15 by bugdroid1@chromium.org, May 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/fb0b3e5ef52521188ba3e56f05666703289b8e74

commit fb0b3e5ef52521188ba3e56f05666703289b8e74
Author: Sangwoo Park <sangwoo2.park@lge.com>
Date: Fri May 19 20:57:14 2017

UPSTREAM: zram: reduce load operation in page_same_filled

In page_same_filled function, all elements in the page is compared with
next index value.  The current comparison routine compares the (i)th and
(i+1)th values of the page.

In this case, two load operaions occur for each comparison.  But if we
store first value of the page stores at 'val' variable and using it to
compare with others, the load opearation is reduced.  It reduce load
operation per page by up to 64times.

BUG= chromium:721934 
TEST=Build and boot

Change-Id: I0e9ddd2c2dbb4ec3ba39cd72310314fd4c465d89
Link: http://lkml.kernel.org/r/1488428104-7257-1-git-send-email-sangwoo2.park@lge.com
Signed-off-by: Sangwoo Park <sangwoo2.park@lge.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from commit f0fe9984656604ea8effd5ff82709ff8ce1f954b)
Reviewed-on: https://chromium-review.googlesource.com/508046
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>

[modify] https://crrev.com/fb0b3e5ef52521188ba3e56f05666703289b8e74/drivers/block/zram/zram_drv.c

Labels: M-60
Status: Fixed (was: Started)

Comment 17 by dchan@chromium.org, Jan 22 2018

Status: Archived (was: Fixed)

Sign in to add a comment