dm kcopyd: introduce configurable throttling
This patch allows the administrator to reduce the rate at which kcopyd issues I/O. Each module that uses kcopyd acquires a throttle parameter that can be set in /sys/module/*/parameters. We maintain a history of kcopyd usage by each module in the variables io_period and total_period in struct dm_kcopyd_throttle. The actual kcopyd activity is calculated as a percentage of time equal to "(100 * io_period / total_period)". This is compared with the user-defined throttle percentage threshold and if it is exceeded, we sleep. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:

committed by
Alasdair G Kergon

parent
a26062416e
commit
df5d2e9089
@@ -82,6 +82,9 @@ struct mirror_set {
|
||||
struct mirror mirror[0];
|
||||
};
|
||||
|
||||
DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(raid1_resync_throttle,
|
||||
"A percentage of time allocated for raid resynchronization");
|
||||
|
||||
static void wakeup_mirrord(void *context)
|
||||
{
|
||||
struct mirror_set *ms = context;
|
||||
@@ -1111,7 +1114,7 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
||||
goto err_destroy_wq;
|
||||
}
|
||||
|
||||
ms->kcopyd_client = dm_kcopyd_client_create();
|
||||
ms->kcopyd_client = dm_kcopyd_client_create(&dm_kcopyd_throttle);
|
||||
if (IS_ERR(ms->kcopyd_client)) {
|
||||
r = PTR_ERR(ms->kcopyd_client);
|
||||
goto err_destroy_wq;
|
||||
|
Reference in New Issue
Block a user