aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wilcox <mawilcox@microsoft.com>2017-09-08 19:14:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-08 21:26:48 -0400
commit48ad1abef40226ce809e5b7d3a5898754c4b9a9a (patch)
tree0ed46388591b7c95983846873cab484256f6a3f0
parent92ce4c3ea7c44e61ca2b6ef3e5682bfcea851d87 (diff)
drivers/block/zram/zram_drv.c: convert to using memset_l
zram was the motivation for creating memset_l(). Minchan Kim sees a 7% performance improvement on x86 with 100MB of non-zero deduplicatable data: perf stat -r 10 dd if=/dev/zram0 of=/dev/null vanilla: 0.232050465 seconds time elapsed ( +- 0.51% ) memset_l: 0.217219387 seconds time elapsed ( +- 0.07% ) Link: http://lkml.kernel.org/r/20170720184539.31609-7-willy@infradead.org Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com> Tested-by: Minchan Kim <minchan@kernel.org> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: David Miller <davem@davemloft.net> Cc: Ingo Molnar <mingo@elte.hu> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Matt Turner <mattst88@gmail.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Richard Henderson <rth@twiddle.net> Cc: Russell King <rmk+kernel@armlinux.org.uk> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/block/zram/zram_drv.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 4063f3f59f4f..2981c27d3aae 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -175,20 +175,11 @@ static inline void update_used_max(struct zram *zram,
175 } while (old_max != cur_max); 175 } while (old_max != cur_max);
176} 176}
177 177
178static inline void zram_fill_page(char *ptr, unsigned long len, 178static inline void zram_fill_page(void *ptr, unsigned long len,
179 unsigned long value) 179 unsigned long value)
180{ 180{
181 int i;
182 unsigned long *page = (unsigned long *)ptr;
183
184 WARN_ON_ONCE(!IS_ALIGNED(len, sizeof(unsigned long))); 181 WARN_ON_ONCE(!IS_ALIGNED(len, sizeof(unsigned long)));
185 182 memset_l(ptr, value, len / sizeof(unsigned long));
186 if (likely(value == 0)) {
187 memset(ptr, 0, len);
188 } else {
189 for (i = 0; i < len / sizeof(*page); i++)
190 page[i] = value;
191 }
192} 183}
193 184
194static bool page_same_filled(void *ptr, unsigned long *element) 185static bool page_same_filled(void *ptr, unsigned long *element)