aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2008-06-17 04:47:08 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-07-03 07:21:13 -0400
commita144ff09bc52ef3f3684ed23eadc9c7c0e57b3aa (patch)
tree344aa7d4722c4b2c39ca3e2fed302f0ff4d5668b /drivers
parent5a60d0cd4ff227c4c5212898ecbeeaf5662eb5fa (diff)
xen: Avoid allocations causing swap activity on the resume path
Avoid allocations causing swap activity on the resume path by preventing the allocations from doing IO and allowing them to access the emergency pools. These paths are used when a frontend device is trying to connect to its backend driver over Xenbus. These reconnections are triggered on demand by IO, so by definition there is already IO underway, and further IO would naturally deadlock. On resume, this path is triggered when the running system tries to continue using its devices. If it cannot then the resume will fail; to try to avoid this we let it dip into the emergency pools. [ linux-2.6.18-xen changesets e8b49cfbdac, fdb998e79aba ] Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/xen-blkfront.c5
-rw-r--r--drivers/net/xen-netfront.c4
-rw-r--r--drivers/xen/xenbus/xenbus_client.c2
-rw-r--r--drivers/xen/xenbus/xenbus_xs.c10
4 files changed, 11 insertions, 10 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index b00682e57393..9ae05c584234 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -584,7 +584,7 @@ static int setup_blkring(struct xenbus_device *dev,
584 584
585 info->ring_ref = GRANT_INVALID_REF; 585 info->ring_ref = GRANT_INVALID_REF;
586 586
587 sring = (struct blkif_sring *)__get_free_page(GFP_KERNEL); 587 sring = (struct blkif_sring *)__get_free_page(GFP_NOIO | __GFP_HIGH);
588 if (!sring) { 588 if (!sring) {
589 xenbus_dev_fatal(dev, -ENOMEM, "allocating shared ring"); 589 xenbus_dev_fatal(dev, -ENOMEM, "allocating shared ring");
590 return -ENOMEM; 590 return -ENOMEM;
@@ -741,7 +741,8 @@ static int blkif_recover(struct blkfront_info *info)
741 int j; 741 int j;
742 742
743 /* Stage 1: Make a safe copy of the shadow state. */ 743 /* Stage 1: Make a safe copy of the shadow state. */
744 copy = kmalloc(sizeof(info->shadow), GFP_KERNEL); 744 copy = kmalloc(sizeof(info->shadow),
745 GFP_NOIO | __GFP_REPEAT | __GFP_HIGH);
745 if (!copy) 746 if (!copy)
746 return -ENOMEM; 747 return -ENOMEM;
747 memcpy(copy, info->shadow, sizeof(info->shadow)); 748 memcpy(copy, info->shadow, sizeof(info->shadow));
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index d26f69b0184f..ef671d1a3bf0 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1324,7 +1324,7 @@ static int setup_netfront(struct xenbus_device *dev, struct netfront_info *info)
1324 goto fail; 1324 goto fail;
1325 } 1325 }
1326 1326
1327 txs = (struct xen_netif_tx_sring *)get_zeroed_page(GFP_KERNEL); 1327 txs = (struct xen_netif_tx_sring *)get_zeroed_page(GFP_NOIO | __GFP_HIGH);
1328 if (!txs) { 1328 if (!txs) {
1329 err = -ENOMEM; 1329 err = -ENOMEM;
1330 xenbus_dev_fatal(dev, err, "allocating tx ring page"); 1330 xenbus_dev_fatal(dev, err, "allocating tx ring page");
@@ -1340,7 +1340,7 @@ static int setup_netfront(struct xenbus_device *dev, struct netfront_info *info)
1340 } 1340 }
1341 1341
1342 info->tx_ring_ref = err; 1342 info->tx_ring_ref = err;
1343 rxs = (struct xen_netif_rx_sring *)get_zeroed_page(GFP_KERNEL); 1343 rxs = (struct xen_netif_rx_sring *)get_zeroed_page(GFP_NOIO | __GFP_HIGH);
1344 if (!rxs) { 1344 if (!rxs) {
1345 err = -ENOMEM; 1345 err = -ENOMEM;
1346 xenbus_dev_fatal(dev, err, "allocating rx ring page"); 1346 xenbus_dev_fatal(dev, err, "allocating rx ring page");
diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
index 0f86b0ff7879..9678b3e98c63 100644
--- a/drivers/xen/xenbus/xenbus_client.c
+++ b/drivers/xen/xenbus/xenbus_client.c
@@ -117,7 +117,7 @@ int xenbus_watch_pathfmt(struct xenbus_device *dev,
117 char *path; 117 char *path;
118 118
119 va_start(ap, pathfmt); 119 va_start(ap, pathfmt);
120 path = kvasprintf(GFP_KERNEL, pathfmt, ap); 120 path = kvasprintf(GFP_NOIO | __GFP_HIGH, pathfmt, ap);
121 va_end(ap); 121 va_end(ap);
122 122
123 if (!path) { 123 if (!path) {
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
index 227d53b12a5c..7f2f91c0e11d 100644
--- a/drivers/xen/xenbus/xenbus_xs.c
+++ b/drivers/xen/xenbus/xenbus_xs.c
@@ -283,9 +283,9 @@ static char *join(const char *dir, const char *name)
283 char *buffer; 283 char *buffer;
284 284
285 if (strlen(name) == 0) 285 if (strlen(name) == 0)
286 buffer = kasprintf(GFP_KERNEL, "%s", dir); 286 buffer = kasprintf(GFP_NOIO | __GFP_HIGH, "%s", dir);
287 else 287 else
288 buffer = kasprintf(GFP_KERNEL, "%s/%s", dir, name); 288 buffer = kasprintf(GFP_NOIO | __GFP_HIGH, "%s/%s", dir, name);
289 return (!buffer) ? ERR_PTR(-ENOMEM) : buffer; 289 return (!buffer) ? ERR_PTR(-ENOMEM) : buffer;
290} 290}
291 291
@@ -297,7 +297,7 @@ static char **split(char *strings, unsigned int len, unsigned int *num)
297 *num = count_strings(strings, len); 297 *num = count_strings(strings, len);
298 298
299 /* Transfer to one big alloc for easy freeing. */ 299 /* Transfer to one big alloc for easy freeing. */
300 ret = kmalloc(*num * sizeof(char *) + len, GFP_KERNEL); 300 ret = kmalloc(*num * sizeof(char *) + len, GFP_NOIO | __GFP_HIGH);
301 if (!ret) { 301 if (!ret) {
302 kfree(strings); 302 kfree(strings);
303 return ERR_PTR(-ENOMEM); 303 return ERR_PTR(-ENOMEM);
@@ -751,7 +751,7 @@ static int process_msg(void)
751 } 751 }
752 752
753 753
754 msg = kmalloc(sizeof(*msg), GFP_KERNEL); 754 msg = kmalloc(sizeof(*msg), GFP_NOIO | __GFP_HIGH);
755 if (msg == NULL) { 755 if (msg == NULL) {
756 err = -ENOMEM; 756 err = -ENOMEM;
757 goto out; 757 goto out;
@@ -763,7 +763,7 @@ static int process_msg(void)
763 goto out; 763 goto out;
764 } 764 }
765 765
766 body = kmalloc(msg->hdr.len + 1, GFP_KERNEL); 766 body = kmalloc(msg->hdr.len + 1, GFP_NOIO | __GFP_HIGH);
767 if (body == NULL) { 767 if (body == NULL) {
768 kfree(msg); 768 kfree(msg);
769 err = -ENOMEM; 769 err = -ENOMEM;