Accepting request 657704 from home:bfrogers:branches:Virtualization
Include fix for xen issue bsc#1100408 OBS-URL: https://build.opensuse.org/request/show/657704 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=437
This commit is contained in:
parent
553a1b583e
commit
63fe54bd7c
79
0039-xen_disk-Avoid-repeated-memory-allo.patch
Normal file
79
0039-xen_disk-Avoid-repeated-memory-allo.patch
Normal file
@ -0,0 +1,79 @@
|
||||
From f88c2f1b54da7a92420724189a6df37e6b3faed3 Mon Sep 17 00:00:00 2001
|
||||
From: Tim Smith <tim.smith@citrix.com>
|
||||
Date: Fri, 2 Nov 2018 10:01:09 +0000
|
||||
Subject: [PATCH] xen_disk: Avoid repeated memory allocation
|
||||
|
||||
xen_disk currently allocates memory to hold the data for each ioreq
|
||||
as that ioreq is used, and frees it afterwards. Because it requires
|
||||
page-aligned blocks, this interacts poorly with non-page-aligned
|
||||
allocations and balloons the heap.
|
||||
|
||||
Instead, allocate the maximum possible requirement, which is
|
||||
BLKIF_MAX_SEGMENTS_PER_REQUEST pages (currently 11 pages) when
|
||||
the ioreq is created, and keep that allocation until it is destroyed.
|
||||
Since the ioreqs themselves are re-used via a free list, this
|
||||
should actually improve memory usage.
|
||||
|
||||
Signed-off-by: Tim Smith <tim.smith@citrix.com>
|
||||
[BSC#1100408]
|
||||
Signed-off-by: Bruce Rogers <brogers@suse.com>
|
||||
---
|
||||
hw/block/xen_disk.c | 7 ++-----
|
||||
1 file changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
|
||||
index d9a55faf27..e9501ee34c 100644
|
||||
--- a/hw/block/xen_disk.c
|
||||
+++ b/hw/block/xen_disk.c
|
||||
@@ -110,7 +110,6 @@ static void ioreq_reset(struct ioreq *ioreq)
|
||||
memset(&ioreq->req, 0, sizeof(ioreq->req));
|
||||
ioreq->status = 0;
|
||||
ioreq->start = 0;
|
||||
- ioreq->buf = NULL;
|
||||
ioreq->size = 0;
|
||||
ioreq->presync = 0;
|
||||
|
||||
@@ -135,6 +134,7 @@ static struct ioreq *ioreq_start(struct XenBlkDev *blkdev)
|
||||
/* allocate new struct */
|
||||
ioreq = g_malloc0(sizeof(*ioreq));
|
||||
ioreq->blkdev = blkdev;
|
||||
+ ioreq->buf = qemu_memalign(XC_PAGE_SIZE, BLKIF_MAX_SEGMENTS_PER_REQUEST * XC_PAGE_SIZE);
|
||||
blkdev->requests_total++;
|
||||
qemu_iovec_init(&ioreq->v, 1);
|
||||
} else {
|
||||
@@ -317,14 +317,12 @@ static void qemu_aio_complete(void *opaque, int ret)
|
||||
if (ret == 0) {
|
||||
ioreq_grant_copy(ioreq);
|
||||
}
|
||||
- qemu_vfree(ioreq->buf);
|
||||
break;
|
||||
case BLKIF_OP_WRITE:
|
||||
case BLKIF_OP_FLUSH_DISKCACHE:
|
||||
if (!ioreq->req.nr_segments) {
|
||||
break;
|
||||
}
|
||||
- qemu_vfree(ioreq->buf);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -392,12 +390,10 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
|
||||
{
|
||||
struct XenBlkDev *blkdev = ioreq->blkdev;
|
||||
|
||||
- ioreq->buf = qemu_memalign(XC_PAGE_SIZE, ioreq->size);
|
||||
if (ioreq->req.nr_segments &&
|
||||
(ioreq->req.operation == BLKIF_OP_WRITE ||
|
||||
ioreq->req.operation == BLKIF_OP_FLUSH_DISKCACHE) &&
|
||||
ioreq_grant_copy(ioreq)) {
|
||||
- qemu_vfree(ioreq->buf);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1007,6 +1003,7 @@ static int blk_free(struct XenDevice *xendev)
|
||||
ioreq = QLIST_FIRST(&blkdev->freelist);
|
||||
QLIST_REMOVE(ioreq, list);
|
||||
qemu_iovec_destroy(&ioreq->v);
|
||||
+ qemu_vfree(ioreq->buf);
|
||||
g_free(ioreq);
|
||||
}
|
||||
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 12 21:33:15 UTC 2018 - Bruce Rogers <brogers@suse.com>
|
||||
|
||||
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-3.1
|
||||
* Patches added:
|
||||
0039-xen_disk-Avoid-repeated-memory-allo.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 11 17:38:47 UTC 2018 - Bruce Rogers <brogers@suse.com>
|
||||
|
||||
|
@ -70,6 +70,7 @@ Patch0035: 0035-tests-test-thread-pool-is-racy-add-.patch
|
||||
Patch0036: 0036-xen-add-block-resize-support-for-xe.patch
|
||||
Patch0037: 0037-tests-qemu-iotests-Triple-timeout-o.patch
|
||||
Patch0038: 0038-tests-block-io-test-130-needs-some-.patch
|
||||
Patch0039: 0039-xen_disk-Avoid-repeated-memory-allo.patch
|
||||
# Please do not add QEMU patches manually here.
|
||||
# Run update_git.sh to regenerate this queue.
|
||||
ExcludeArch: s390
|
||||
@ -139,6 +140,7 @@ syscall layer occurs on the native hardware and operating system.
|
||||
%patch0036 -p1
|
||||
%patch0037 -p1
|
||||
%patch0038 -p1
|
||||
%patch0039 -p1
|
||||
|
||||
%build
|
||||
./configure \
|
||||
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 12 21:33:13 UTC 2018 - Bruce Rogers <brogers@suse.com>
|
||||
|
||||
- fix memory leak in xen_disk (bsc#1100408)
|
||||
0039-xen_disk-Avoid-repeated-memory-allo.patch
|
||||
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-3.1
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 12 09:31:20 UTC 2018 - olaf@aepfle.de
|
||||
|
||||
|
@ -175,6 +175,7 @@ Patch0035: 0035-tests-test-thread-pool-is-racy-add-.patch
|
||||
Patch0036: 0036-xen-add-block-resize-support-for-xe.patch
|
||||
Patch0037: 0037-tests-qemu-iotests-Triple-timeout-o.patch
|
||||
Patch0038: 0038-tests-block-io-test-130-needs-some-.patch
|
||||
Patch0039: 0039-xen_disk-Avoid-repeated-memory-allo.patch
|
||||
# Please do not add QEMU patches manually here.
|
||||
# Run update_git.sh to regenerate this queue.
|
||||
|
||||
@ -941,6 +942,7 @@ This package provides a service file for starting and stopping KSM.
|
||||
%patch0036 -p1
|
||||
%patch0037 -p1
|
||||
%patch0038 -p1
|
||||
%patch0039 -p1
|
||||
|
||||
pushd roms/seabios
|
||||
%patch1100 -p1
|
||||
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 12 21:33:13 UTC 2018 - Bruce Rogers <brogers@suse.com>
|
||||
|
||||
- fix memory leak in xen_disk (bsc#1100408)
|
||||
0039-xen_disk-Avoid-repeated-memory-allo.patch
|
||||
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-3.1
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 12 09:31:20 UTC 2018 - olaf@aepfle.de
|
||||
|
||||
|
@ -175,6 +175,7 @@ Patch0035: 0035-tests-test-thread-pool-is-racy-add-.patch
|
||||
Patch0036: 0036-xen-add-block-resize-support-for-xe.patch
|
||||
Patch0037: 0037-tests-qemu-iotests-Triple-timeout-o.patch
|
||||
Patch0038: 0038-tests-block-io-test-130-needs-some-.patch
|
||||
Patch0039: 0039-xen_disk-Avoid-repeated-memory-allo.patch
|
||||
# Please do not add QEMU patches manually here.
|
||||
# Run update_git.sh to regenerate this queue.
|
||||
|
||||
@ -941,6 +942,7 @@ This package provides a service file for starting and stopping KSM.
|
||||
%patch0036 -p1
|
||||
%patch0037 -p1
|
||||
%patch0038 -p1
|
||||
%patch0039 -p1
|
||||
|
||||
pushd roms/seabios
|
||||
%patch1100 -p1
|
||||
|
Loading…
Reference in New Issue
Block a user