dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [PATCH] dm: allocate buffer for messages with small number of arguments with GFP_NOIO
@ 2013-09-30 17:54 Mikulas Patocka
  2013-09-30 19:48 ` Alasdair G Kergon
  0 siblings, 1 reply; 2+ messages in thread
From: Mikulas Patocka @ 2013-09-30 17:54 UTC (permalink / raw)
  To: Alasdair G. Kergon; +Cc: dm-devel, Mike Snitzer

Hi

Here I'm sending the GFP_NOIO message patch.

I tried the approach with double scan of the message and no reallocation, 
but it performs 5% worse on dm-switch table loading. So I stayed with the 
current approach that does single scan and argv reallocation.

Mikulas

---

dm: allocate buffer for messages with small number of arguments with 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 and
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@kernel.org

---
 drivers/md/dm-table.c |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

Index: linux-3.11.2-fast/drivers/md/dm-table.c
===================================================================
--- linux-3.11.2-fast.orig/drivers/md/dm-table.c	2013-09-30 19:39:40.000000000 +0200
+++ linux-3.11.2-fast/drivers/md/dm-table.c	2013-09-30 19:40:44.000000000 +0200
@@ -545,14 +545,28 @@ static int adjoin(struct dm_table *table
 
 /*
  * Used to dynamically allocate the arg array.
+ *
+ * We do first allocation with GFP_NOIO because dm-mpath and dm-thin must
+ * process messages even if some device is suspended. These messages have a
+ * small fixed number of arguments.
+ *
+ * On the other hand, dm-switch needs to process bulk data using messages and
+ * excessive use of GFP_NOIO could cause trouble.
  */
 static char **realloc_argv(unsigned *array_size, char **old_argv)
 {
 	char **argv;
 	unsigned new_size;
+	gfp_t gfp;
 
-	new_size = *array_size ? *array_size * 2 : 64;
-	argv = kmalloc(new_size * sizeof(*argv), GFP_KERNEL);
+	if (*array_size) {
+		new_size = *array_size * 2;
+		gfp = GFP_KERNEL;
+	} else {
+		new_size = 8;
+		gfp = GFP_NOIO;
+	}
+	argv = kmalloc(new_size * sizeof(*argv), gfp);
 	if (argv) {
 		memcpy(argv, old_argv, *array_size * sizeof(*argv));
 		*array_size = new_size;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-09-30 19:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-30 17:54 [PATCH] dm: allocate buffer for messages with small number of arguments with GFP_NOIO Mikulas Patocka
2013-09-30 19:48 ` Alasdair G Kergon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).