aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-table.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2013-10-31 13:55:45 -0400
committerMike Snitzer <snitzer@redhat.com>2013-10-31 13:55:45 -0400
commitf36afb3957353d2529cb2b00f78fdccd14fc5e9c (patch)
tree0c2e9f902291df81d42c15c6b5c237c810ff3a51 /drivers/md/dm-table.c
parent61e6cfa80de5760bbe406f4e815b7739205754d2 (diff)
dm: allocate buffer for messages with small number of arguments using GFP_NOIO
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> Cc: stable@vger.kernel.org Acked-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-table.c')
-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 8f8783533ac7..41d907b58f7e 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -545,14 +545,28 @@ static int adjoin(struct dm_table *table, struct dm_target *ti)
545 545
546/* 546/*
547 * Used to dynamically allocate the arg array. 547 * Used to dynamically allocate the arg array.
548 *
549 * We do first allocation with GFP_NOIO because dm-mpath and dm-thin must
550 * process messages even if some device is suspended. These messages have a
551 * small fixed number of arguments.
552 *
553 * On the other hand, dm-switch needs to process bulk data using messages and
554 * excessive use of GFP_NOIO could cause trouble.
548 */ 555 */
549static char **realloc_argv(unsigned *array_size, char **old_argv) 556static char **realloc_argv(unsigned *array_size, char **old_argv)
550{ 557{
551 char **argv; 558 char **argv;
552 unsigned new_size; 559 unsigned new_size;
560 gfp_t gfp;
553 561
554 new_size = *array_size ? *array_size * 2 : 64; 562 if (*array_size) {
555 argv = kmalloc(new_size * sizeof(*argv), GFP_KERNEL); 563 new_size = *array_size * 2;
564 gfp = GFP_KERNEL;
565 } else {
566 new_size = 8;
567 gfp = GFP_NOIO;
568 }
569 argv = kmalloc(new_size * sizeof(*argv), gfp);
556 if (argv) { 570 if (argv) {
557 memcpy(argv, old_argv, *array_size * sizeof(*argv)); 571 memcpy(argv, old_argv, *array_size * sizeof(*argv));
558 *array_size = new_size; 572 *array_size = new_size;