dm crypt: use cond_resched
authorMilan Broz <[email protected]>
Wed, 2 Jul 2008 08:34:28 +0000 (09:34 +0100)
committerAlasdair G Kergon <[email protected]>
Wed, 2 Jul 2008 08:34:28 +0000 (09:34 +0100)
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: Milan Broz <[email protected]>
Tested-by: Yan Li <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Alasdair G Kergon <[email protected]>
drivers/md/dm-crypt.c

index 835def11419d36d7b56e0e216028714d384ad0f9..ab6a61db63ce2248b5553ec43678fab61642e9a7 100644 (file)
@@ -432,6 +432,7 @@ static int crypt_convert(struct crypt_config *cc,
                case 0:
                        atomic_dec(&ctx->pending);
                        ctx->sector++;
+                       cond_resched();
                        continue;
 
                /* error */