aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2013-10-31 13:55:45 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-04 13:56:44 -0500
commit4c52f001344510d1e26a33cfdf971a12338a63d9 (patch)
tree2fdb798dc331e41b94508204655c56f38017ccbf /drivers/md
parent8fafee9829f539e17ea8678a6f56d2b897ffe3cc (diff)
dm: allocate buffer for messages with small number of arguments using GFP_NOIO
commit f36afb3957353d2529cb2b00f78fdccd14fc5e9c upstream. dm-mpath and dm-thin must process messages even if some device is suspended, so we allocate argv buffer with GFP_NOIO. These messages have a small fixed number of arguments. On the other hand, dm-switch needs to process bulk data using messages so excessive use of GFP_NOIO could cause trouble. The patch also lowers the default number of arguments from 64 to 8, so that there is smaller load on GFP_NOIO allocations. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Acked-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-table.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 1ff252ab7d46..9e3a045eb7a2 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -580,14 +580,28 @@ static int adjoin(struct dm_table *table, struct dm_target *ti)
580 580
581/* 581/*
582 * Used to dynamically allocate the arg array. 582 * Used to dynamically allocate the arg array.
583 *
584 * We do first allocation with GFP_NOIO because dm-mpath and dm-thin must
585 * process messages even if some device is suspended. These messages have a
586 * small fixed number of arguments.
587 *
588 * On the other hand, dm-switch needs to process bulk data using messages and
589 * excessive use of GFP_NOIO could cause trouble.
583 */ 590 */
584static char **realloc_argv(unsigned *array_size, char **old_argv) 591static char **realloc_argv(unsigned *array_size, char **old_argv)
585{ 592{
586 char **argv; 593 char **argv;
587 unsigned new_size; 594 unsigned new_size;
595 gfp_t gfp;
588 596
589 new_size = *array_size ? *array_size * 2 : 64; 597 if (*array_size) {
590 argv = kmalloc(new_size * sizeof(*argv), GFP_KERNEL); 598 new_size = *array_size * 2;
599 gfp = GFP_KERNEL;
600 } else {
601 new_size = 8;
602 gfp = GFP_NOIO;
603 }
604 argv = kmalloc(new_size * sizeof(*argv), gfp);
591 if (argv) { 605 if (argv) {
592 memcpy(argv, old_argv, *array_size * sizeof(*argv)); 606 memcpy(argv, old_argv, *array_size * sizeof(*argv));
593 *array_size = new_size; 607 *array_size = new_size;