Skip to contentSkip to conversation

drivers/block/zram/zram_drv.c: convert to using memset_l

PATCH New [email protected] 1 participant 1 message Sep 8, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 58/126 drivers/block/zram/zram_drv.c: convert to using memset_l

From: Matthew Wilcox <[email protected]>
Subject: 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% )

Cc Sergey Senozhatsky <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
Cc David Miller <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Ivan Kokshaysky <[email protected]>
Cc Matt Turner <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Russell King <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Thomas Gleixner <[email protected]>

---

 drivers/block/zram/zram_drv.c |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/block/zram/zram_drv.c renamed from drivers/block/zram/zram_drv.c~zram-convert-to-using-memset_l +1 -4
diff -puN drivers/block/zram/zram_drv.c~zram-convert-to-using-memset_l drivers/block/zram/zram_drv.c
@@ -175,20 +175,11 @@ static inline void update_used_max(struc
 	} while (old_max != cur_max);
 }
 
-static inline void zram_fill_page(char *ptr, unsigned long len,
+static inline void zram_fill_page(void *ptr, unsigned long len,
 					unsigned long value)
 {
-	int i;
-	unsigned long *page = (unsigned long *)ptr;
-
 	WARN_ON_ONCE(!IS_ALIGNED(len, sizeof(unsigned long)));