Increase throughput by telling the VM to not be too eager trying to allocate memory and possibly start swapping or flushing just because we need to allocate temporary buffers by dropping PF_MEMALLOC. We've got an emergency pool via mempool for this. [Christophe Saout] --- diff/drivers/md/dm-crypt.c 2004-01-03 12:14:19.000000000 +0000 +++ source/drivers/md/dm-crypt.c 2004-01-03 12:14:25.000000000 +0000 @@ -68,7 +68,7 @@ }; #define MIN_IOS 256 -#define MIN_POOL_PAGES 16 +#define MIN_POOL_PAGES 32 #define MIN_BIO_PAGES 8 static kmem_cache_t *_crypt_io_pool; @@ -193,8 +193,16 @@ struct bio *bio; int nr_iovecs = dm_div_up(size, PAGE_SIZE); int gfp_mask = GFP_NOIO | __GFP_HIGHMEM; + int flags = current->flags; int i; + /* + * Tell VM to act less aggressively and fail earlier. + * This is not necessary but increases throughput. + * FIXME: Is this really intelligent? + */ + current->flags &= ~PF_MEMALLOC; + if (base_bio) bio = bio_clone(base_bio, GFP_NOIO); else @@ -236,6 +244,9 @@ size -= bv->bv_len; } + if (flags & PF_MEMALLOC) + current->flags |= PF_MEMALLOC; + if (!bio->bi_size) { bio_put(bio); return NULL;