memchr_inv() is the preferred way to check if a memory region is all
zeros. It is likely fast that memcmp() is it doesn't need to read the
ZERO_PAGE into cache, or into the CPU. It was introduced in Linux
3.2.
Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I0a5c3d30d5db43a3f5ebb270ea66b9db2b200a9a
Reviewed-on: https://review.whamcloud.com/39459
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
struct brw_page *pg = aa->aa_ppga[idx];
/* do not decrypt if page is all 0s */
- if (memcmp(page_address(pg->pg),
- page_address(ZERO_PAGE(0)),
- PAGE_SIZE) == 0) {
+ if (memchr_inv(page_address(pg->pg), 0,
+ PAGE_SIZE) == NULL) {
/* if page is empty forward info to upper layers
* (ll_io_zero_page) by clearing PagePrivate2
*/