From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Sander Eikelenboom <linux@eikelenboom.it>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
David Vrabel <david.vrabel@citrix.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [GIT PULL] (xen) stable/for-jens-3.10 xenwatch: page allocation failure: order:7, mode:0x10c0d0
Date: Thu, 25 Apr 2013 17:52:03 +0200 [thread overview]
Message-ID: <51795123.1040800@citrix.com> (raw)
In-Reply-To: <51792417.2090302@citrix.com>
[-- Attachment #1: Type: text/plain, Size: 6555 bytes --]
On 25/04/13 14:39, Roger Pau Monné wrote:
> On 25/04/13 14:32, Sander Eikelenboom wrote:
>>
>> Thursday, April 25, 2013, 10:43:33 AM, you wrote:
>>
>>> On 25/04/13 10:35, Roger Pau Monné wrote:
>>>> On 24/04/13 20:16, Sander Eikelenboom wrote:
>>>>> Friday, April 19, 2013, 4:44:01 PM, you wrote:
>>>>>
>>>>>> Hey Jens,
>>>>>
>>>>>> Please in your spare time (if there is such a thing at a conference)
>>>>>> pull this branch:
>>>>>
>>>>>> git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git stable/for-jens-3.10
>>>>>
>>>>>> for your v3.10 branch. Sorry for being so late with this.
>>>>>
>>>>> <big snip></big snip>
>>>>>
>>>>>> Anyhow, please pull and if possible include the nice overview I typed up in the
>>>>>> merge commit.
>>>>>
>>>>>> Documentation/ABI/stable/sysfs-bus-xen-backend | 18 +
>>>>>> drivers/block/xen-blkback/blkback.c | 843 ++++++++++++++++---------
>>>>>> drivers/block/xen-blkback/common.h | 145 ++++-
>>>>>> drivers/block/xen-blkback/xenbus.c | 38 ++
>>>>>> drivers/block/xen-blkfront.c | 490 +++++++++++---
>>>>>> include/xen/interface/io/blkif.h | 53 ++
>>>>>> 6 files changed, 1188 insertions(+), 399 deletions(-)
>>>>>
>>>>>> Roger Pau Monne (7):
>>>>>> xen-blkback: print stats about persistent grants
>>>>>> xen-blkback: use balloon pages for all mappings
>>>>>> xen-blkback: implement LRU mechanism for persistent grants
>>>>>> xen-blkback: move pending handles list from blkbk to pending_req
>>>>>> xen-blkback: make the queue of free requests per backend
>>>>>> xen-blkback: expand map/unmap functions
>>>>>> xen-block: implement indirect descriptors
>>>>>
>>>>>
>>>>> Hi Konrad / Roger,
>>>>>
>>>>> I tried this pull on top of latest Linus latest linux-3.9 tree, but although it seems to boot and work fine at first, i seem to get trouble after running for about a day.
>>>>> Without this pull it runs fine for several days.
>>>>>
>>>>> Trying to start a new guest I ended up with the splat below. In the output of xl-dmesg i seem to see more of these than before:
>>>>> (XEN) [2013-04-24 14:37:40] grant_table.c:1250:d1 Expanding dom (1) grant table from (9) to (10) frames
>>>>
>>>> Hello Sander,
>>>>
>>>> Thanks for the report, it is expected to see more messages regarding
>>>> grant table expansion with this patch, since we are using up to 1056
>>>> persistent grants for each backend. Could you try lowering down the
>>>> maximum number of persistent grants to see if that prevents running out
>>>> of memory:
>>>>
>>>> # echo 384 > /sys/module/xen_blkback/parameters/max_persistent_grants
>>
>>> And the number of free pages keep in blkback cache:
>>
>> # echo 256 >> /sys/module/xen_blkback/parameters/max_buffer_pages
>>
>> With both set .. it still bails out after sometime when trying to start a new guest.
>
> OK, will work on a patch to split memory allocation instead of doing it
> all in a big chunk.
Could you try the following patch?
---
>From db0163f74dafb085457d843c6ab7935d5dc7bd65 Mon Sep 17 00:00:00 2001
From: Roger Pau Monne <roger.pau@citrix.com>
Date: Thu, 25 Apr 2013 17:48:32 +0200
Subject: [PATCH] xen-blkback: allocate list of pending reqs in small chunks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Allocate pending requests in smaller chunks instead of allocating them
all at the same time.
Also remove the global array of pending_reqs, it is no longer
necessary.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
drivers/block/xen-blkback/common.h | 2 -
drivers/block/xen-blkback/xenbus.c | 41 ++++++++++++++++++++++-------------
2 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
index 1ac53da..2bbda8637 100644
--- a/drivers/block/xen-blkback/common.h
+++ b/drivers/block/xen-blkback/common.h
@@ -297,8 +297,6 @@ struct xen_blkif {
int free_pages_num;
struct list_head free_pages;
- /* Allocation of pending_reqs */
- struct pending_req *pending_reqs;
/* List of all 'pending_req' available */
struct list_head pending_free;
/* And its spinlock. */
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index afab208..ceefbe4 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -105,6 +105,7 @@ static void xen_update_blkif_status(struct xen_blkif *blkif)
static struct xen_blkif *xen_blkif_alloc(domid_t domid)
{
struct xen_blkif *blkif;
+ struct pending_req *req, *n;
int i;
BUILD_BUG_ON(MAX_INDIRECT_PAGES > BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST);
@@ -127,22 +128,29 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid)
blkif->free_pages_num = 0;
atomic_set(&blkif->persistent_gnt_in_use, 0);
- blkif->pending_reqs = kcalloc(XEN_BLKIF_REQS,
- sizeof(blkif->pending_reqs[0]),
- GFP_KERNEL);
- if (!blkif->pending_reqs) {
- kmem_cache_free(xen_blkif_cachep, blkif);
- return ERR_PTR(-ENOMEM);
- }
INIT_LIST_HEAD(&blkif->pending_free);
+
+ for (i = 0; i < XEN_BLKIF_REQS; i++) {
+ req = kzalloc(sizeof(*req), GFP_KERNEL);
+ if (!req)
+ goto fail;
+ list_add_tail(&req->free_list,
+ &blkif->pending_free);
+ }
spin_lock_init(&blkif->pending_free_lock);
init_waitqueue_head(&blkif->pending_free_wq);
- for (i = 0; i < XEN_BLKIF_REQS; i++)
- list_add_tail(&blkif->pending_reqs[i].free_list,
- &blkif->pending_free);
-
return blkif;
+
+fail:
+ list_for_each_entry_safe(req, n, &blkif->pending_free, free_list) {
+ list_del(&req->free_list);
+ kfree(req);
+ }
+
+ kmem_cache_free(xen_blkif_cachep, blkif);
+
+ return ERR_PTR(-ENOMEM);
}
static int xen_blkif_map(struct xen_blkif *blkif, unsigned long shared_page,
@@ -221,18 +229,21 @@ static void xen_blkif_disconnect(struct xen_blkif *blkif)
static void xen_blkif_free(struct xen_blkif *blkif)
{
- struct pending_req *req;
+ struct pending_req *req, *n;
int i = 0;
if (!atomic_dec_and_test(&blkif->refcnt))
BUG();
/* Check that there is no request in use */
- list_for_each_entry(req, &blkif->pending_free, free_list)
+ list_for_each_entry_safe(req, n, &blkif->pending_free, free_list) {
+ list_del(&req->free_list);
+ kfree(req);
i++;
- BUG_ON(i != XEN_BLKIF_REQS);
+ }
+
+ WARN_ON(i != XEN_BLKIF_REQS);
- kfree(blkif->pending_reqs);
kmem_cache_free(xen_blkif_cachep, blkif);
}
--
1.7.7.5 (Apple Git-26)
[-- Attachment #2: 0001-xen-blkback-allocate-list-of-pending-reqs-in-small-c.patch --]
[-- Type: text/plain, Size: 3528 bytes --]
>From db0163f74dafb085457d843c6ab7935d5dc7bd65 Mon Sep 17 00:00:00 2001
From: Roger Pau Monne <roger.pau@citrix.com>
Date: Thu, 25 Apr 2013 17:48:32 +0200
Subject: [PATCH] xen-blkback: allocate list of pending reqs in small chunks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Allocate pending requests in smaller chunks instead of allocating them
all at the same time.
Also remove the global array of pending_reqs, it is no longer
necessary.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
drivers/block/xen-blkback/common.h | 2 -
drivers/block/xen-blkback/xenbus.c | 41 ++++++++++++++++++++++-------------
2 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
index 1ac53da..2bbda8637 100644
--- a/drivers/block/xen-blkback/common.h
+++ b/drivers/block/xen-blkback/common.h
@@ -297,8 +297,6 @@ struct xen_blkif {
int free_pages_num;
struct list_head free_pages;
- /* Allocation of pending_reqs */
- struct pending_req *pending_reqs;
/* List of all 'pending_req' available */
struct list_head pending_free;
/* And its spinlock. */
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index afab208..ceefbe4 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -105,6 +105,7 @@ static void xen_update_blkif_status(struct xen_blkif *blkif)
static struct xen_blkif *xen_blkif_alloc(domid_t domid)
{
struct xen_blkif *blkif;
+ struct pending_req *req, *n;
int i;
BUILD_BUG_ON(MAX_INDIRECT_PAGES > BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST);
@@ -127,22 +128,29 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid)
blkif->free_pages_num = 0;
atomic_set(&blkif->persistent_gnt_in_use, 0);
- blkif->pending_reqs = kcalloc(XEN_BLKIF_REQS,
- sizeof(blkif->pending_reqs[0]),
- GFP_KERNEL);
- if (!blkif->pending_reqs) {
- kmem_cache_free(xen_blkif_cachep, blkif);
- return ERR_PTR(-ENOMEM);
- }
INIT_LIST_HEAD(&blkif->pending_free);
+
+ for (i = 0; i < XEN_BLKIF_REQS; i++) {
+ req = kzalloc(sizeof(*req), GFP_KERNEL);
+ if (!req)
+ goto fail;
+ list_add_tail(&req->free_list,
+ &blkif->pending_free);
+ }
spin_lock_init(&blkif->pending_free_lock);
init_waitqueue_head(&blkif->pending_free_wq);
- for (i = 0; i < XEN_BLKIF_REQS; i++)
- list_add_tail(&blkif->pending_reqs[i].free_list,
- &blkif->pending_free);
-
return blkif;
+
+fail:
+ list_for_each_entry_safe(req, n, &blkif->pending_free, free_list) {
+ list_del(&req->free_list);
+ kfree(req);
+ }
+
+ kmem_cache_free(xen_blkif_cachep, blkif);
+
+ return ERR_PTR(-ENOMEM);
}
static int xen_blkif_map(struct xen_blkif *blkif, unsigned long shared_page,
@@ -221,18 +229,21 @@ static void xen_blkif_disconnect(struct xen_blkif *blkif)
static void xen_blkif_free(struct xen_blkif *blkif)
{
- struct pending_req *req;
+ struct pending_req *req, *n;
int i = 0;
if (!atomic_dec_and_test(&blkif->refcnt))
BUG();
/* Check that there is no request in use */
- list_for_each_entry(req, &blkif->pending_free, free_list)
+ list_for_each_entry_safe(req, n, &blkif->pending_free, free_list) {
+ list_del(&req->free_list);
+ kfree(req);
i++;
- BUG_ON(i != XEN_BLKIF_REQS);
+ }
+
+ WARN_ON(i != XEN_BLKIF_REQS);
- kfree(blkif->pending_reqs);
kmem_cache_free(xen_blkif_cachep, blkif);
}
--
1.7.7.5 (Apple Git-26)
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2013-04-25 15:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-19 14:44 [GIT PULL] (xen) stable/for-jens-3.10 Konrad Rzeszutek Wilk
2013-04-24 18:16 ` [GIT PULL] (xen) stable/for-jens-3.10 xenwatch: page allocation failure: order:7, mode:0x10c0d0 Sander Eikelenboom
2013-04-25 8:35 ` Roger Pau Monné
2013-04-25 8:40 ` Sander Eikelenboom
2013-04-25 8:43 ` Roger Pau Monné
2013-04-25 12:32 ` Sander Eikelenboom
2013-04-25 12:39 ` Roger Pau Monné
2013-04-25 15:52 ` Roger Pau Monné [this message]
2013-04-25 16:38 ` David Vrabel
2013-04-25 10:04 ` David Vrabel
2013-04-29 15:46 ` [Xen-devel] " Konrad Rzeszutek Wilk
2013-04-29 16:05 ` Sander Eikelenboom
2013-05-04 7:34 ` [Xen-devel] " Sander Eikelenboom
2013-05-06 9:00 ` Roger Pau Monné
2013-04-29 19:14 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51795123.1040800@citrix.com \
--to=roger.pau@citrix.com \
--cc=david.vrabel@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=linux@eikelenboom.it \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).