lkml.org 
[lkml]   [2005]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[5/5] [CRYPTO] Optimise kmap calls in crypt()
From
Hi:

Perform kmap once (or twice if the buffer is not aligned correctly)
per page in crypt() instead of the current code which does it once
per block. Consequently it will yield once per page instead of once
per block.

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
diff -Nru a/crypto/cipher.c b/crypto/cipher.c
--- a/crypto/cipher.c 2005-03-21 18:44:41 +11:00
+++ b/crypto/cipher.c 2005-03-21 18:44:41 +11:00
@@ -117,17 +117,21 @@

in_place = scatterwalk_samebuf(&walk_in, &walk_out);

- src_p = prepare_src(&walk_in, bsize, tmp_src, in_place);
- dst_p = prepare_dst(&walk_out, bsize, tmp_dst, in_place);
+ do {
+ src_p = prepare_src(&walk_in, bsize, tmp_src,
+ in_place);
+ dst_p = prepare_dst(&walk_out, bsize, tmp_dst,
+ in_place);

- nbytes -= bsize;
+ prfn(tfm, dst_p, src_p, crfn, enc, info);

- prfn(tfm, dst_p, src_p, crfn, enc, info);
+ complete_src(&walk_in, bsize, src_p, in_place);
+ complete_dst(&walk_out, bsize, dst_p, in_place);

- complete_src(&walk_in, bsize, src_p, in_place);
- scatterwalk_done(&walk_in, 0, nbytes);
+ nbytes -= bsize;
+ } while (nbytes && !scatterwalk_across_pages(&walk_in, bsize));

- complete_dst(&walk_out, bsize, dst_p, in_place);
+ scatterwalk_done(&walk_in, 0, nbytes);
scatterwalk_done(&walk_out, 1, nbytes);

if (!nbytes)
\
 
 \ /
  Last update: 2005-03-22 14:11    [W:0.064 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site