Re: [PATCH 1/2] dm-band: The I/O bandwidth controller: Source code patch
Frans Pop wrote: > The help should probably be a bit more verbose as this does not tell > anybody much who has not already read the documentation. > > Maybe something like: > > This device-mapper target allows to define how the > available bandwith of a storage device should be > shared between processes or cgroups. > > Information on how to use dm-band is available in: >Documentation/device-mapper/band.txt > I just see in other Kconfig files that the last line should be: . Cheers, FJP -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] dm-band: The I/O bandwidth controller: Source code patch
Frans Pop wrote: The help should probably be a bit more verbose as this does not tell anybody much who has not already read the documentation. Maybe something like: snip This device-mapper target allows to define how the available bandwith of a storage device should be shared between processes or cgroups. Information on how to use dm-band is available in: Documentation/device-mapper/band.txt /snip I just see in other Kconfig files that the last line should be: file:Documentation/device-mapper/band.txt. Cheers, FJP -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] dm-band: The I/O bandwidth controller: Source code patch
Hi Frans, > I'm not qualified to comment on the code, but here are some suggestions on > config option and comments. Thank you for your suggstions. I will correct those mistakes. -- Ryo Tsuruta <[EMAIL PROTECTED]> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] dm-band: The I/O bandwidth controller: Source code patch
Hi, I'm not qualified to comment on the code, but here are some suggestions on config option and comments. Cheers, FJP Ryo Tsuruta wrote: > +config DM_BAND > + tristate "I/O band width control " s/band width/bandwidth/ (it seems to be used correctly elsewhere, but you may want to double-check) > + depends on BLK_DEV_DM > + ---help--- > + Any processes or cgroups can use the same storage > + with its band-width fairly shared. s/band-width/bandwidth/ The help should probably be a bit more verbose as this does not tell anybody much who has not already read the documentation. Maybe something like: This device-mapper target allows to define how the available bandwith of a storage device should be shared between processes or cgroups. Information on how to use dm-band is available in: Documentation/device-mapper/band.txt > + * The following functiotons determine when and which BIOs should ^^^ > + * be submitted to control the I/O flow. > + * It is possible to add a new I/O scheduling policy with it. > + * > + * g_can_submit : To determine whether a given group has a right to s/a right/the right/ > + * submit BIOs. > + * The larger return value the higher priority to submit. > + * Zero means it has no right. "The larger the return value, the higher the priority [...]" > + * g_prepare_bio : Called right before submitting each BIO. > + * g_restart_bios : Called when there exist some BIOs blocked but none of > them > + * can't be submitted now. s/when there exist some BIOs blocked/if some BIOs exist that are blocked/ ? "none of them can't" : the double negative looks incorrect (and should be avoided anyway) > + * This method have to do something to restart to submit BIOs. s/have/has/ "has to do something" : that's rather vague... -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] dm-band: The I/O bandwidth controller: Source code patch
Here is the patch of dm-band. Based on 2.6.23.14 Signed-off-by: Ryo Tsuruta <[EMAIL PROTECTED]> Signed-off-by: Hirokazu Takahashi <[EMAIL PROTECTED]> diff -uprN linux-2.6.23.14.orig/drivers/md/Kconfig linux-2.6.23.14/drivers/md/Kconfig --- linux-2.6.23.14.orig/drivers/md/Kconfig 2008-01-15 05:49:56.0 +0900 +++ linux-2.6.23.14/drivers/md/Kconfig 2008-01-21 16:09:41.0 +0900 @@ -276,4 +276,13 @@ config DM_DELAY If unsure, say N. +config DM_BAND + tristate "I/O band width control " + depends on BLK_DEV_DM + ---help--- + Any processes or cgroups can use the same storage + with its band-width fairly shared. + + If unsure, say N. + endif # MD diff -uprN linux-2.6.23.14.orig/drivers/md/Makefile linux-2.6.23.14/drivers/md/Makefile --- linux-2.6.23.14.orig/drivers/md/Makefile2008-01-15 05:49:56.0 +0900 +++ linux-2.6.23.14/drivers/md/Makefile 2008-01-21 20:45:03.0 +0900 @@ -8,6 +8,7 @@ dm-multipath-objs := dm-hw-handler.o dm- dm-snapshot-objs := dm-snap.o dm-exception-store.o dm-mirror-objs := dm-log.o dm-raid1.o dm-rdac-objs := dm-mpath-rdac.o +dm-band-objs := dm-bandctl.o dm-band-policy.o dm-band-type.o md-mod-objs := md.o bitmap.o raid456-objs := raid5.o raid6algos.o raid6recov.o raid6tables.o \ raid6int1.o raid6int2.o raid6int4.o \ @@ -39,6 +40,7 @@ obj-$(CONFIG_DM_MULTIPATH_RDAC) += dm-rd obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o obj-$(CONFIG_DM_MIRROR)+= dm-mirror.o obj-$(CONFIG_DM_ZERO) += dm-zero.o +obj-$(CONFIG_DM_BAND) += dm-band.o quiet_cmd_unroll = UNROLL $@ cmd_unroll = $(PERL) $(srctree)/$(src)/unroll.pl $(UNROLL) \ diff -uprN linux-2.6.23.14.orig/drivers/md/dm-band-policy.c linux-2.6.23.14/drivers/md/dm-band-policy.c --- linux-2.6.23.14.orig/drivers/md/dm-band-policy.c1970-01-01 09:00:00.0 +0900 +++ linux-2.6.23.14/drivers/md/dm-band-policy.c 2008-01-21 20:31:14.0 +0900 @@ -0,0 +1,185 @@ +/* + * Copyright (C) 2008 VA Linux Systems Japan K.K. + * + * I/O bandwidth control + * + * This file is released under the GPL. + */ +#include +#include +#include "dm.h" +#include "dm-bio-list.h" +#include "dm-band.h" + +/* + * The following functiotons determine when and which BIOs should + * be submitted to control the I/O flow. + * It is possible to add a new I/O scheduling policy with it. + */ + + +/* + * Functions for weight balancing policy. + */ +#define DEFAULT_WEIGHT 100 +#define DEFAULT_TOKENBASE 2048 +#define BAND_IOPRIO_BASE 100 + +static int proceed_global_epoch(struct banddevice *bs) +{ + bs->g_epoch++; +#if 0 /* this will also work correct */ + if (bs->g_blocked) + queue_work(bs->g_band_wq, >g_conductor); + return 0; +#endif + dprintk(KERN_ERR "proceed_epoch %d --> %d\n", + bs->g_epoch-1, bs->g_epoch); + return 1; +} + +static inline int proceed_epoch(struct bandgroup *bw) +{ + struct banddevice *bs = bw->c_shared; + + if (bw->c_my_epoch != bs->g_epoch) { + bw->c_my_epoch = bs->g_epoch; + return 1; + } + return 0; +} + +static inline int iopriority(struct bandgroup *bw) +{ + struct banddevice *bs = bw->c_shared; + int iopri; + + iopri = bw->c_token*BAND_IOPRIO_BASE/bw->c_token_init_value + 1; + if (bw->c_my_epoch != bs->g_epoch) + iopri += BAND_IOPRIO_BASE; + if (bw->c_going_down) + iopri += BAND_IOPRIO_BASE*2; + + return iopri; +} + +static int is_token_left(struct bandgroup *bw) +{ + if (bw->c_token > 0) + return iopriority(bw); + + if (proceed_epoch(bw) || bw->c_going_down) { + bw->c_token = bw->c_token_init_value; + dprintk(KERN_ERR "refill token: bw:%p token:%d\n", + bw, bw->c_token); + return iopriority(bw); + } + return 0; +} + +static void prepare_token(struct bandgroup *bw, struct bio *bio) +{ + bw->c_token--; +} + +static void set_weight(struct bandgroup *bw, int new) +{ + struct banddevice *bs = bw->c_shared; + struct bandgroup *p; + + bs->g_weight_total += (new - bw->c_weight); + bw->c_weight = new; + + list_for_each_entry(p, >g_brothers, c_list) { + /* Fixme: it might overflow */ + p->c_token = p->c_token_init_value = + bs->g_token_base*p->c_weight/bs->g_weight_total + 1; + } +} + +static int policy_weight_ctr(struct bandgroup *bw) +{ + struct banddevice *bs = bw->c_shared; + + bw->c_my_epoch = bs->g_epoch; + bw->c_weight = 0; + set_weight(bw, DEFAULT_WEIGHT); + return 0; +} + +static void policy_weight_dtr(struct bandgroup *bw) +{ + set_weight(bw, 0); +} + +static int policy_weight_param(struct bandgroup *bw, char
[PATCH 1/2] dm-band: The I/O bandwidth controller: Source code patch
Here is the patch of dm-band. Based on 2.6.23.14 Signed-off-by: Ryo Tsuruta [EMAIL PROTECTED] Signed-off-by: Hirokazu Takahashi [EMAIL PROTECTED] diff -uprN linux-2.6.23.14.orig/drivers/md/Kconfig linux-2.6.23.14/drivers/md/Kconfig --- linux-2.6.23.14.orig/drivers/md/Kconfig 2008-01-15 05:49:56.0 +0900 +++ linux-2.6.23.14/drivers/md/Kconfig 2008-01-21 16:09:41.0 +0900 @@ -276,4 +276,13 @@ config DM_DELAY If unsure, say N. +config DM_BAND + tristate I/O band width control + depends on BLK_DEV_DM + ---help--- + Any processes or cgroups can use the same storage + with its band-width fairly shared. + + If unsure, say N. + endif # MD diff -uprN linux-2.6.23.14.orig/drivers/md/Makefile linux-2.6.23.14/drivers/md/Makefile --- linux-2.6.23.14.orig/drivers/md/Makefile2008-01-15 05:49:56.0 +0900 +++ linux-2.6.23.14/drivers/md/Makefile 2008-01-21 20:45:03.0 +0900 @@ -8,6 +8,7 @@ dm-multipath-objs := dm-hw-handler.o dm- dm-snapshot-objs := dm-snap.o dm-exception-store.o dm-mirror-objs := dm-log.o dm-raid1.o dm-rdac-objs := dm-mpath-rdac.o +dm-band-objs := dm-bandctl.o dm-band-policy.o dm-band-type.o md-mod-objs := md.o bitmap.o raid456-objs := raid5.o raid6algos.o raid6recov.o raid6tables.o \ raid6int1.o raid6int2.o raid6int4.o \ @@ -39,6 +40,7 @@ obj-$(CONFIG_DM_MULTIPATH_RDAC) += dm-rd obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o obj-$(CONFIG_DM_MIRROR)+= dm-mirror.o obj-$(CONFIG_DM_ZERO) += dm-zero.o +obj-$(CONFIG_DM_BAND) += dm-band.o quiet_cmd_unroll = UNROLL $@ cmd_unroll = $(PERL) $(srctree)/$(src)/unroll.pl $(UNROLL) \ diff -uprN linux-2.6.23.14.orig/drivers/md/dm-band-policy.c linux-2.6.23.14/drivers/md/dm-band-policy.c --- linux-2.6.23.14.orig/drivers/md/dm-band-policy.c1970-01-01 09:00:00.0 +0900 +++ linux-2.6.23.14/drivers/md/dm-band-policy.c 2008-01-21 20:31:14.0 +0900 @@ -0,0 +1,185 @@ +/* + * Copyright (C) 2008 VA Linux Systems Japan K.K. + * + * I/O bandwidth control + * + * This file is released under the GPL. + */ +#include linux/bio.h +#include linux/workqueue.h +#include dm.h +#include dm-bio-list.h +#include dm-band.h + +/* + * The following functiotons determine when and which BIOs should + * be submitted to control the I/O flow. + * It is possible to add a new I/O scheduling policy with it. + */ + + +/* + * Functions for weight balancing policy. + */ +#define DEFAULT_WEIGHT 100 +#define DEFAULT_TOKENBASE 2048 +#define BAND_IOPRIO_BASE 100 + +static int proceed_global_epoch(struct banddevice *bs) +{ + bs-g_epoch++; +#if 0 /* this will also work correct */ + if (bs-g_blocked) + queue_work(bs-g_band_wq, bs-g_conductor); + return 0; +#endif + dprintk(KERN_ERR proceed_epoch %d -- %d\n, + bs-g_epoch-1, bs-g_epoch); + return 1; +} + +static inline int proceed_epoch(struct bandgroup *bw) +{ + struct banddevice *bs = bw-c_shared; + + if (bw-c_my_epoch != bs-g_epoch) { + bw-c_my_epoch = bs-g_epoch; + return 1; + } + return 0; +} + +static inline int iopriority(struct bandgroup *bw) +{ + struct banddevice *bs = bw-c_shared; + int iopri; + + iopri = bw-c_token*BAND_IOPRIO_BASE/bw-c_token_init_value + 1; + if (bw-c_my_epoch != bs-g_epoch) + iopri += BAND_IOPRIO_BASE; + if (bw-c_going_down) + iopri += BAND_IOPRIO_BASE*2; + + return iopri; +} + +static int is_token_left(struct bandgroup *bw) +{ + if (bw-c_token 0) + return iopriority(bw); + + if (proceed_epoch(bw) || bw-c_going_down) { + bw-c_token = bw-c_token_init_value; + dprintk(KERN_ERR refill token: bw:%p token:%d\n, + bw, bw-c_token); + return iopriority(bw); + } + return 0; +} + +static void prepare_token(struct bandgroup *bw, struct bio *bio) +{ + bw-c_token--; +} + +static void set_weight(struct bandgroup *bw, int new) +{ + struct banddevice *bs = bw-c_shared; + struct bandgroup *p; + + bs-g_weight_total += (new - bw-c_weight); + bw-c_weight = new; + + list_for_each_entry(p, bs-g_brothers, c_list) { + /* Fixme: it might overflow */ + p-c_token = p-c_token_init_value = + bs-g_token_base*p-c_weight/bs-g_weight_total + 1; + } +} + +static int policy_weight_ctr(struct bandgroup *bw) +{ + struct banddevice *bs = bw-c_shared; + + bw-c_my_epoch = bs-g_epoch; + bw-c_weight = 0; + set_weight(bw, DEFAULT_WEIGHT); + return 0; +} + +static void policy_weight_dtr(struct bandgroup *bw) +{ + set_weight(bw, 0); +} + +static int policy_weight_param(struct bandgroup *bw, char *cmd, char *value) +{
Re: [PATCH 1/2] dm-band: The I/O bandwidth controller: Source code patch
Hi, I'm not qualified to comment on the code, but here are some suggestions on config option and comments. Cheers, FJP Ryo Tsuruta wrote: +config DM_BAND + tristate I/O band width control s/band width/bandwidth/ (it seems to be used correctly elsewhere, but you may want to double-check) + depends on BLK_DEV_DM + ---help--- + Any processes or cgroups can use the same storage + with its band-width fairly shared. s/band-width/bandwidth/ The help should probably be a bit more verbose as this does not tell anybody much who has not already read the documentation. Maybe something like: snip This device-mapper target allows to define how the available bandwith of a storage device should be shared between processes or cgroups. Information on how to use dm-band is available in: Documentation/device-mapper/band.txt /snip + * The following functiotons determine when and which BIOs should ^^^ + * be submitted to control the I/O flow. + * It is possible to add a new I/O scheduling policy with it. + * Method description + * g_can_submit : To determine whether a given group has a right to s/a right/the right/ + * submit BIOs. + * The larger return value the higher priority to submit. + * Zero means it has no right. The larger the return value, the higher the priority [...] + * g_prepare_bio : Called right before submitting each BIO. + * g_restart_bios : Called when there exist some BIOs blocked but none of them + * can't be submitted now. s/when there exist some BIOs blocked/if some BIOs exist that are blocked/ ? none of them can't : the double negative looks incorrect (and should be avoided anyway) + * This method have to do something to restart to submit BIOs. s/have/has/ has to do something : that's rather vague... -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] dm-band: The I/O bandwidth controller: Source code patch
Hi Frans, I'm not qualified to comment on the code, but here are some suggestions on config option and comments. Thank you for your suggstions. I will correct those mistakes. -- Ryo Tsuruta [EMAIL PROTECTED] -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/