UPSTREAM: zram: reduce load operation in page_same_filled
authorSangwoo Park <sangwoo2.park@lge.com>
Wed, 3 May 2017 21:55:56 +0000 (14:55 -0700)
committerivanmeler <i_ivan@windowslive.com>
Wed, 13 Apr 2022 21:13:21 +0000 (21:13 +0000)
commit6d0db3d8e73c39c6d8c075fa12d77c87ab98e453
tree321702ec9f06fc9ff03b5b8f71171e6987c86481
parent32f507171ed1d3504057c1a0b6f36b1618191dec
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.

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>
(cherry picked from commit f0fe9984656604ea8effd5ff82709ff8ce1f954b)
Signed-off-by: Peter Kalauskas <peskal@google.com>
Bug: 112488418
Change-Id: I6b58b583e83139eee9f0540da12850c43510cb8e
drivers/block/zram/zram_drv.c