Commit c7f1b204 authored by Milan Broz's avatar Milan Broz Committed by Alasdair G Kergon

dm crypt: use cond_resched

Add cond_resched() to prevent monopolising CPU when processing large bios.

dm-crypt processes encryption of bios in sector units.  If the bio request
is big it can spend a long time in the encryption call.
Signed-off-by: default avatarMilan Broz <mbroz@redhat.com>
Tested-by: default avatarYan Li <elliot.li.tech@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent e1441b9a
...@@ -432,6 +432,7 @@ static int crypt_convert(struct crypt_config *cc, ...@@ -432,6 +432,7 @@ static int crypt_convert(struct crypt_config *cc,
case 0: case 0:
atomic_dec(&ctx->pending); atomic_dec(&ctx->pending);
ctx->sector++; ctx->sector++;
cond_resched();
continue; continue;
/* error */ /* error */
......
Markdown is supported
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