Skip to content
Commit 77292bb8 authored by Barry Song's avatar Barry Song Committed by Herbert Xu
Browse files

crypto: scomp - remove memcpy if sg_nents is 1 and pages are lowmem



while sg_nents is 1, which is always true for the current kernel
as the only user - zswap is this case, we might have a chance to
remove memcpy, thus improve the performance.
Though sg_nents is 1, its buffer might cross two pages. If those
pages are highmem, we have no cheap way to map them to contiguous
virtual address because kmap doesn't support more than one page
(kmap single higmem page could be still expensive for tlb) and
vmap is expensive.
So we also test and enure page is not highmem in order to safely
use page_to_virt before removing the memcpy. The good news is
that in the most majority of cases, we are lowmem, and we are
always lowmem in those modern and popular hardware.

Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: default avatarBarry Song <v-songbaohua@oppo.com>
Tested-by: default avatarChengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 43a7885e
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment