diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2011-05-29 08:03:00 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2011-05-29 08:03:00 -0400 |
commit | c6ea41fbbe08f270a8edef99dc369faf809d1bd6 (patch) | |
tree | 34210fcc635c029939d43b3b556314210c7171c5 /crypto/deflate.c | |
parent | a705a34a565a5445bf731bd8006d51ea4d2b4236 (diff) |
dm kcopyd: preallocate sub jobs to avoid deadlock
There's a possible theoretical deadlock in dm-kcopyd because multiple
allocations from the same mempool are required to finish a request.
Avoid this by preallocating sub jobs.
There is a mempool of 512 entries. Each request requires up to 9
entries from the mempool. If we have at least 57 concurrent requests
running, the mempool may overflow and mempool allocations may start
blocking until another entry is freed to the mempool. Because the same
thread is used to free entries to the mempool and allocate entries from
the mempool, this may result in a deadlock.
This patch changes it so that one mempool entry contains all 9 "struct
kcopyd_job" required to fulfill the whole request. The allocation is
done only once in dm_kcopyd_copy and no further mempool allocations are
done during request processing.
If dm_kcopyd_copy is not run in the completion thread, this
implementation is deadlock-free.
MIN_JOBS needs reducing accordingly and we've chosen to reduce it
further to 8.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'crypto/deflate.c')
0 files changed, 0 insertions, 0 deletions