FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 05-31-2011, 10:03 PM
Mikulas Patocka
 
Default dm-kcopyd: introduce per-module throttle structure

Hi

Here I'm sending new kcopyd throttling patches that allow the throttle to
be set per module (i.e. one throttle for mirror and the other for
snapshots).

Mikulas

---

dm-kcopyd: introduce per-module throttle structure

The structure contains the throttle parameter (it could be set in
/sys/module/*/parameters and auxulary variables for activity counting.

The throttle does nothing, it will be activated in the next patch.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
drivers/md/dm-kcopyd.c | 2 +-
drivers/md/dm-raid1.c | 5 ++++-
drivers/md/dm-snap.c | 5 ++++-
include/linux/dm-kcopyd.h | 15 ++++++++++++++-
4 files changed, 23 insertions(+), 4 deletions(-)

Index: linux-2.6.39-fast/drivers/md/dm-kcopyd.c
================================================== =================
--- linux-2.6.39-fast.orig/drivers/md/dm-kcopyd.c 2011-05-31 23:46:18.000000000 +0200
+++ linux-2.6.39-fast/drivers/md/dm-kcopyd.c 2011-05-31 23:49:47.000000000 +0200
@@ -617,7 +617,7 @@ int kcopyd_cancel(struct kcopyd_job *job
/*-----------------------------------------------------------------
* Client setup
*---------------------------------------------------------------*/
-struct dm_kcopyd_client *dm_kcopyd_client_create(void)
+struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *throttle)
{
int r = -ENOMEM;
struct dm_kcopyd_client *kc;
Index: linux-2.6.39-fast/drivers/md/dm-raid1.c
================================================== =================
--- linux-2.6.39-fast.orig/drivers/md/dm-raid1.c 2011-05-31 23:46:18.000000000 +0200
+++ linux-2.6.39-fast/drivers/md/dm-raid1.c 2011-05-31 23:46:22.000000000 +0200
@@ -83,6 +83,9 @@ struct mirror_set {
struct mirror mirror[0];
};

+dm_kcopyd_throttle_declare(raid1_resync_throttle,
+ "A percentage of time allocated for raid resynchronization");
+
static void wakeup_mirrord(void *context)
{
struct mirror_set *ms = context;
@@ -1115,7 +1118,7 @@ static int mirror_ctr(struct dm_target *
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;
Index: linux-2.6.39-fast/drivers/md/dm-snap.c
================================================== =================
--- linux-2.6.39-fast.orig/drivers/md/dm-snap.c 2011-05-31 23:46:18.000000000 +0200
+++ linux-2.6.39-fast/drivers/md/dm-snap.c 2011-05-31 23:46:22.000000000 +0200
@@ -135,6 +135,9 @@ struct dm_snapshot {
#define RUNNING_MERGE 0
#define SHUTDOWN_MERGE 1

+dm_kcopyd_throttle_declare(snapshot_copy_throttle ,
+ "A percentage of time allocated for copy on write");
+
struct dm_dev *dm_snap_origin(struct dm_snapshot *s)
{
return s->origin;
@@ -1111,7 +1114,7 @@ static int snapshot_ctr(struct dm_target
goto bad_hash_tables;
}

- s->kcopyd_client = dm_kcopyd_client_create();
+ s->kcopyd_client = dm_kcopyd_client_create(&dm_kcopyd_throttle);
if (IS_ERR(s->kcopyd_client)) {
r = PTR_ERR(s->kcopyd_client);
ti->error = "Could not create kcopyd client";
Index: linux-2.6.39-fast/include/linux/dm-kcopyd.h
================================================== =================
--- linux-2.6.39-fast.orig/include/linux/dm-kcopyd.h 2011-05-31 23:46:18.000000000 +0200
+++ linux-2.6.39-fast/include/linux/dm-kcopyd.h 2011-05-31 23:46:22.000000000 +0200
@@ -21,11 +21,24 @@

#define DM_KCOPYD_IGNORE_ERROR 1

+struct dm_kcopyd_throttle {
+ unsigned throttle;
+ unsigned long num_io_jobs;
+ unsigned io_period;
+ unsigned total_period;
+ unsigned last_jiffies;
+};
+
+#define dm_kcopyd_throttle_declare(name, description)
+static struct dm_kcopyd_throttle dm_kcopyd_throttle = { 100, 0, 0, 0, 0 };
+module_param_named(name, dm_kcopyd_throttle.throttle, uint, 0644);
+MODULE_PARM_DESC(name, description)
+
/*
* To use kcopyd you must first create a dm_kcopyd_client object.
*/
struct dm_kcopyd_client;
-struct dm_kcopyd_client *dm_kcopyd_client_create(void);
+struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *throttle);
void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc);

/*

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 06-03-2011, 03:54 PM
Mike Snitzer
 
Default dm-kcopyd: introduce per-module throttle structure

On Fri, Jun 03 2011 at 7:01am -0400,
Joe Thornber <thornber@redhat.com> wrote:

> On Thu, Jun 02, 2011 at 03:55:16PM -0400, Mikulas Patocka wrote:
> > > iv) you haven't explained how the sys admin works out the correct
> > > throttle value.
> >
> > There is no "correct" value. The "correct" value depends on how important
> > is copying itself v.s. other i/o.
>
> So who is going to set this? Do you really have no advice for them
> beyond 'there is no correct value'?
>
> > In theory (if disk scheduler were perfect), we wouldn't need any
> > throttling. The disk scheduler should recognize that the kcopyd process is
> > sending way more requests than any other process and should lower the
> > i/o priority of kcopyd process.
> >
> > In practice, the disk scheduler doesn't do it well, so kcopyd hurts the
> > users. If you want an automated fix, fix the disk scheduler. But don't put
> > disk scheduler logic into device mapper --- it dosn't belong there.
>
> I totally agree with these two paragraphs. Any throttling you add to
> kcopyd is always going to be a hack.

Wouldn't it be better to tie in to the block layer's new throttling
infrastructure that Vivek added? Possibly expose a callback that
enables kcopyd consuming devices to throttle kcopyd as a side-effect of
the higher-level throttle?

Mike

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 06-10-2011, 01:51 PM
Mike Snitzer
 
Default dm-kcopyd: introduce per-module throttle structure

On Fri, Jun 10 2011 at 9:41am -0400,
Mikulas Patocka <mpatocka@redhat.com> wrote:

>
>
> On Fri, 10 Jun 2011, Joe Thornber wrote:
>
> > On Fri, Jun 10, 2011 at 11:28:34AM +0200, Lars Ellenberg wrote:
> > > On Fri, Jun 10, 2011 at 09:44:25AM +0100, Joe Thornber wrote:
> > > > On Thu, Jun 09, 2011 at 12:08:08PM -0400, Mikulas Patocka wrote:
> > > > >
> > > > >
> > > > > On Thu, 9 Jun 2011, Joe Thornber wrote:
> > > > > > What we're trying to do is avoid kcopyd issuing so much io that it
> > > > > > interferes with userland io.
> > > > >
> > > > > But you don't know if there is some userland IO or not to the same disk.
> > > >
> > > > None the less, this was the motivation Alasdair gave for wanting this
> > > > throttling.
> > >
> > > Not sure if it helps,
> > > but are you familiar with the MD raid rebuild throttling?
> >
> > Lars,
> >
> > This is very helpful, thankyou. Any thoughts on this Mikulas?
> >
> > - Joe
>
> This works if the data is directly on the partition, but it won't work on
> the device mapper (if MD is on the device mapper, it won't work too).
>
> The device mapper has no function to tell where the bio is finally
> remapped, so you can't read disk statistics for that particular disk.

DM raid in terms of MD (as Jon and Neil are working on) has functional
resync throttling. So DM wrapping MD raid gives us what we need without
the need to change kcopyd no?

Mike

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 03:20 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org