[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] Use GFP_NOIO to avoid allocations which swap on resume.



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1213084239 -3600
# Node ID 5db911a71eac6b0b19e74398f0750ce12fb1b94b
# Parent  8523584ffaa3b0f6ecce36b826a2c7b26aef61b7
Use GFP_NOIO to avoid allocations which swap on resume.

377:e8b49cfbdac0 and 497:fdb998e79aba added __GFP_HIGH to allocations
which could cause swap on resume. __GFP_HIGH actually only makes such
allocations less likely (by allowing access to the emergency pools of
memory).

See: http://marc.info/?l=linux-kernel&m=121222807617695&w=2

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 drivers/xen/blkfront/blkfront.c    |    4 ++--
 drivers/xen/netfront/netfront.c    |    4 ++--
 drivers/xen/xenbus/xenbus_client.c |    2 +-
 drivers/xen/xenbus/xenbus_xs.c     |   12 ++++++------
 4 files changed, 11 insertions(+), 11 deletions(-)

diff -r 8523584ffaa3 -r 5db911a71eac drivers/xen/blkfront/blkfront.c
--- a/drivers/xen/blkfront/blkfront.c   Tue Jun 10 08:35:59 2008 +0100
+++ b/drivers/xen/blkfront/blkfront.c   Tue Jun 10 08:50:39 2008 +0100
@@ -219,7 +219,7 @@ static int setup_blkring(struct xenbus_d
 
        info->ring_ref = GRANT_INVALID_REF;
 
-       sring = (blkif_sring_t *)__get_free_page(GFP_KERNEL|__GFP_HIGH);
+       sring = (blkif_sring_t *)__get_free_page(GFP_NOIO | __GFP_HIGH);
        if (!sring) {
                xenbus_dev_fatal(dev, -ENOMEM, "allocating shared ring");
                return -ENOMEM;
@@ -817,7 +817,7 @@ static void blkif_recover(struct blkfron
        int j;
 
        /* Stage 1: Make a safe copy of the shadow state. */
-       copy = kmalloc(sizeof(info->shadow), GFP_KERNEL | __GFP_NOFAIL | 
__GFP_HIGH);
+       copy = kmalloc(sizeof(info->shadow), GFP_NOIO | __GFP_NOFAIL | 
__GFP_HIGH);
        memcpy(copy, info->shadow, sizeof(info->shadow));
 
        /* Stage 2: Set up free list. */
diff -r 8523584ffaa3 -r 5db911a71eac drivers/xen/netfront/netfront.c
--- a/drivers/xen/netfront/netfront.c   Tue Jun 10 08:35:59 2008 +0100
+++ b/drivers/xen/netfront/netfront.c   Tue Jun 10 08:50:39 2008 +0100
@@ -478,7 +478,7 @@ static int setup_device(struct xenbus_de
        info->tx.sring = NULL;
        info->irq = 0;
 
-       txs = (struct netif_tx_sring *)get_zeroed_page(GFP_KERNEL|__GFP_HIGH);
+       txs = (struct netif_tx_sring *)get_zeroed_page(GFP_NOIO | __GFP_HIGH);
        if (!txs) {
                err = -ENOMEM;
                xenbus_dev_fatal(dev, err, "allocating tx ring page");
@@ -494,7 +494,7 @@ static int setup_device(struct xenbus_de
        }
        info->tx_ring_ref = err;
 
-       rxs = (struct netif_rx_sring *)get_zeroed_page(GFP_KERNEL|__GFP_HIGH);
+       rxs = (struct netif_rx_sring *)get_zeroed_page(GFP_NOIO | __GFP_HIGH);
        if (!rxs) {
                err = -ENOMEM;
                xenbus_dev_fatal(dev, err, "allocating rx ring page");
diff -r 8523584ffaa3 -r 5db911a71eac drivers/xen/xenbus/xenbus_client.c
--- a/drivers/xen/xenbus/xenbus_client.c        Tue Jun 10 08:35:59 2008 +0100
+++ b/drivers/xen/xenbus/xenbus_client.c        Tue Jun 10 08:50:39 2008 +0100
@@ -87,7 +87,7 @@ int xenbus_watch_path2(struct xenbus_dev
                                        const char **, unsigned int))
 {
        int err;
-       char *state = kasprintf(GFP_KERNEL|__GFP_HIGH, "%s/%s", path, path2);
+       char *state = kasprintf(GFP_NOIO | __GFP_HIGH, "%s/%s", path, path2);
        if (!state) {
                xenbus_dev_fatal(dev, -ENOMEM, "allocating path for watch");
                return -ENOMEM;
diff -r 8523584ffaa3 -r 5db911a71eac drivers/xen/xenbus/xenbus_xs.c
--- a/drivers/xen/xenbus/xenbus_xs.c    Tue Jun 10 08:35:59 2008 +0100
+++ b/drivers/xen/xenbus/xenbus_xs.c    Tue Jun 10 08:50:39 2008 +0100
@@ -291,9 +291,9 @@ static char *join(const char *dir, const
        char *buffer;
 
        if (strlen(name) == 0)
-               buffer = kasprintf(GFP_KERNEL|__GFP_HIGH, "%s", dir);
+               buffer = kasprintf(GFP_NOIO | __GFP_HIGH, "%s", dir);
        else
-               buffer = kasprintf(GFP_KERNEL|__GFP_HIGH, "%s/%s", dir, name);
+               buffer = kasprintf(GFP_NOIO | __GFP_HIGH, "%s/%s", dir, name);
        return (!buffer) ? ERR_PTR(-ENOMEM) : buffer;
 }
 
@@ -305,7 +305,7 @@ static char **split(char *strings, unsig
        *num = count_strings(strings, len) + 1;
 
        /* Transfer to one big alloc for easy freeing. */
-       ret = kmalloc(*num * sizeof(char *) + len, GFP_KERNEL|__GFP_HIGH);
+       ret = kmalloc(*num * sizeof(char *) + len, GFP_NOIO | __GFP_HIGH);
        if (!ret) {
                kfree(strings);
                return ERR_PTR(-ENOMEM);
@@ -507,7 +507,7 @@ int xenbus_printf(struct xenbus_transact
 #define PRINTF_BUFFER_SIZE 4096
        char *printf_buffer;
 
-       printf_buffer = kmalloc(PRINTF_BUFFER_SIZE, GFP_KERNEL|__GFP_HIGH);
+       printf_buffer = kmalloc(PRINTF_BUFFER_SIZE, GFP_NOIO | __GFP_HIGH);
        if (printf_buffer == NULL)
                return -ENOMEM;
 
@@ -791,7 +791,7 @@ static int process_msg(void)
        }
 
 
-       msg = kmalloc(sizeof(*msg), GFP_KERNEL|__GFP_HIGH);
+       msg = kmalloc(sizeof(*msg), GFP_NOIO | __GFP_HIGH);
        if (msg == NULL) {
                err = -ENOMEM;
                goto out;
@@ -803,7 +803,7 @@ static int process_msg(void)
                goto out;
        }
 
-       body = kmalloc(msg->hdr.len + 1, GFP_KERNEL|__GFP_HIGH);
+       body = kmalloc(msg->hdr.len + 1, GFP_NOIO | __GFP_HIGH);
        if (body == NULL) {
                kfree(msg);
                err = -ENOMEM;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.