From patchwork Thu Aug 9 14:20:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10561465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8AAAB14C0 for ; Thu, 9 Aug 2018 14:25:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A4FB2B54B for ; Thu, 9 Aug 2018 14:25:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CB052B567; Thu, 9 Aug 2018 14:25:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A30EB2B566 for ; Thu, 9 Aug 2018 14:25:15 +0000 (UTC) Received: from localhost ([::1]:51151 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnlsI-0000Xh-RP for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 10:25:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnloV-0004Ke-Ee for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:21:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnloS-0004ZX-3J for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:21:19 -0400 Received: from mail-dm3nam03on0120.outbound.protection.outlook.com ([104.47.41.120]:52704 helo=NAM03-DM3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnloR-0004WW-HO; Thu, 09 Aug 2018 10:21:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janustech.onmicrosoft.com; s=selector1-janustech-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=we7UWg3uDKKtBf3oetv2mxBpvNXXl3dd+2IBfM7EK9I=; b=TcSUkPnH4MZVrBG5VVgKqDMrLV9F/8zjJDbzxs6vkUk2fltcyOzReuM/UlJxifbH/1LlzfsEvodVgq3ZUfVaEXBUaKIrLN3Hjkl4jU7tq4ShK5p1v3fWWLwWMKi5845SZBRwiVTyjZZKOjtjI+wT1nAaech5Z3lO3WU1ES+lLgo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2618.namprd07.prod.outlook.com (2a01:111:e400:c637::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.18; Thu, 9 Aug 2018 14:21:11 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 17:20:41 +0300 Message-Id: <20180809142046.12311-1-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: DB6PR0202CA0004.eurprd02.prod.outlook.com (2603:10a6:4:29::14) To CY1PR07MB2618.namprd07.prod.outlook.com (2a01:111:e400:c637::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b5a060a-0ee7-4d7d-bf1c-08d5fe035c3d X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:CY1PR07MB2618; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2618; 3:5QNL9x97zzNTywmSwk5hfs3pi9Z1WDweBXBjsYVnc4mVC7NHBW2bsjuX2knbcjVyjUvlsXafzSn9GruUhsrb/H7Q38AMvWcTEAsamDsSExGuxLfgQev2dsk16HpvUhq4LjnwN4J/QUrdeoKJYtp8On5hPcukMpfL7NdFw2DqbG+7QbLa77bfKNf2Bd9HNT+LZPt+YzVb/3E2/1K89UdeQAMskqjISBIUhNkCL6Ixq52nM2Q2F6cy3odawHi1iGIm; 25:VVhGhdGxObIx9c0NXnzJI0EE6Jb8B8ULffGOp9lAoS3LM7BIqvivSZoP0nqyEeUWeR/sheTBPSA+jypvkwP2Lvac6qRTUVWLNeyfKX34HWOvqk2DZ57t6g6NV2vLFkLHvPp6EaDNBCnYOMFirwRpPbiGvkDWk8iOshbZRYZOPvJkoMwqrKCD0nwIiwu5TR/Oq0HxQAuAv6k74rcXkPfUK2URikH8nPtJ25ipMkU3o6y7RR6rhJmbSbCO1GzuQvaYb+ZKLZFPHp3z3f6H99RP6NXGdbFkGm+5bQvzQ194ukhIVmwTzasQ/4SMUIZbJcA6JMwdRK3Q5euF1cFdawbuIA==; 31:OknYW9JGO5bN2HJJLyG8zfhnO/KJewNuMzvSZhMWeOB7D7cOx/8l6NkO7xFI/XLbRwAFTRr6gN62/Y6uuWlnKL3tEtlIgHYyN+NnXegBhospOuxqSrJ/w5Kxx1578AT/7rFgF/hAXg+2IglVKRno4NQfjV1XRFjyrvY3Rbk7c9nNQ60xf9C8e8ppQo7S8x59qngtCbpfJAAa4EdXNlGG/cIa3LlYwBwO5QdkBPkKe1s= X-MS-TrafficTypeDiagnostic: CY1PR07MB2618: X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6043046)(6072148)(201708071742011)(7699016); SRVR:CY1PR07MB2618; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2618; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2618; 4:5fGDGU1lxDVXjKuLCuUtbJ4bS57aFQBvY45LVH+2kYb/8Z3XmzqqxN00zWOuPyl6WcX1QUMPxUqbDQFHQ50jn3O9+WXQl+JEgQdK5I3daHyVlacYdR6O353D1rosxgOktcH4VN5c9MTmYB+L990iiAeO6DJpqJjAm6HS14ndi8IQmFt0mV1lndd9g/b7UO0Kp0RAXUvxMUaze+PrtW28BBRvoF5dBtSsRL2eZ3Sy6+tlbS5D8US5fdUl0c8/LO9T30FM7GhZ1ylPS9XuHvIiBQ== X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(346002)(376002)(39830400003)(136003)(366004)(199004)(189003)(25786009)(68736007)(53936002)(6666003)(81156014)(14444005)(81166006)(47776003)(6916009)(50226002)(6512007)(8676002)(305945005)(107886003)(7736002)(4326008)(86362001)(186003)(66066001)(26005)(2616005)(956004)(478600001)(486006)(16526019)(386003)(476003)(6506007)(316002)(106356001)(105586002)(50466002)(48376002)(5660300001)(8936002)(6486002)(36756003)(15650500001)(54906003)(16586007)(51416003)(52116002)(2906002)(6116002)(3846002)(2361001)(1076002)(97736004)(2351001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2618; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2618; 23:cVlB2k2OUZ6RpMSgWa95VJ6xmHcX4J2VnM8Ir47gL?= eZV6hnbSs9qnGVLmuM+IWMsb0fTOyyx0yeUCYvP8cCQD+Q0lqy/M8iT6VTsFOEFjqGkHuLibAFe4CnGo+AVYEroxDuvvLWz47sqJ1s4UUiP9zPdcRqE3ykR7RXXmoLlnqmoCzUXeNWfl6wz+YxrGqQ6wJRPb88Wu3DM57D58XIxtEC4b49CFZ48b2PWFwe7R7KLjFHJXLarR6FhN0g1OiQb7JdhBF+3mQUK6g81CsjQS5uu/QGda0QeQynazUrjFu6AERyVCLS36sc8Tc1ZxGv46QAABrEx3PDTIho6nI6IdlXT4lkJjyyi1JWFYavV+Z/O24hgy8PzxYdz8ConbBQNghhbcdrISBBIjJ41YTntbPus0ZuA/cMv1EtuTJ7MkT6Z1BoXfRx0CffybFkU9YQzPsB9XQw3yAiydpiB6bRubYQ4m7oeMKRm0WxjEL2FKkTSxpIGJ59wX+7XqnIOUaNJpeejqfMPSE6K109mRgDPggUehDzHJsiBQwG2wgboydiBPVN8JKuORsVc3pQJDF2x0SeWUK2VxWET3jsmu2SBOPj0qBL8pDeBhgx6ALOzWXHBuXmpewWYsXzenwxfWG5xQA+lcRuq0QnjwIK5ZYhaaui0smrFipn97ftDVnaLj/quKNWgJ7BbEi3cBbvjOtzmMnFEuRnSIzbDoeEFIWDKnp197HJ6l8Vi2PGE3xqdbtxDK6GXM6v5x9I7mttIxGjOxnq2qukQ54JQf6A64Ce1FYkx+sLkg/PVbyDz70Romun6Z2f4CEa5wttSWME4RCXAdmiqpBVRlPBImvg/JM4G4WiT4CKKiqU6at8OCAcAt0CU/yJfVHFJzP2jYpnzbtCTKjxnv3UjDCETaLhntoqLsDL/wZCni76j9LTtorc7MOsQuEHDMCmnTzhHlWwMTcEgZX9/9k1w7Y/10IgJaaitWhOsD0wiyfS94BgS0NfI5PlZMSNK7stK20ezWFrJvqk9GqbqpizcAwC5zTLHOtOATIO2d9TaSkblVEH6sqFTkELKqOkV9BryDfFF0xqoVYaKyLlgXL+6HaIwb1E3Wtc8MaiPIFX08dBrgY/XzcBeiDItwrGyS3YbXxkXtkUBsv4b6nRzQHPPGggfF2BOLojYX5FIeK2zRC/6gW0bs95mf0kpDz2wakz87kM4ORf5+95HuqZc8F9+MM+sUYjOEDC1AkqkT9U5y84xiFgTUgwqY7c= X-Microsoft-Antispam-Message-Info: Rj2/9VX5RhEyDNxQQiItxEYsVwEKLmNRRCWogvkID6QgFzhzL8stlJj25szMJZ/k/4AJLZEU1L0ge+JpRRQQBAWMf6Zs4xK8RmFCsecs7Vj94AeIQE1nAJYRTnIKkXe8i82NRrExuiU1uh/kR+PmjvT+sKtz4MtPhaAthPjbY7keLs33Du7bDbUGXdKErThf51XOV94D2e0yXSpDaDaskz95EfyhV3Rhpfk3rIAvEx3oUIvRbZkT4OYD9R4CSs8KuO1D/qhymDmM6Fn06SST1oHt3C4Xs8/trWp1sQETqr85xgGdLuDoBdtQc6bpUGn7wvweWlze6mraY5n5YTLAKoUT5tfe9oR7gYxGOn6MLAk= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2618; 6:zXP6x+LtIE7xej7riY0QsIWk+S/YDebsYnfUpUAuSyO+pTwUyDTboP9Dij5pGWc21mZZusBm8EWBLfTdkh66Y0dsbf8J1TzO3mgulsH9kuKbNbsrRNbbqTfiwIFNTZkCVwIaVWWRjSSR56d8FZZpem8PLcuwWwg6Jbd/cr+WRCnYCORoURm87w+nSivtereeds1gC3imhevLaYuLe7Xcev90eCxdSdyHY4Oe475E1HQY2b699lh8u1EM8DaccYGeX1GnUvQqnUrCyBIsZ+/dcp1EgC9bPmCRPbFE70X4RZJaBvhpkYNeL3lF8UEdbqaWqYE7oPdepFPksO2XcOy++7O68aASjnK3a1F7SEDCmXgyuoA695aFcilWhysA29IOI/s9Kcehm2/GDgpHy+nFx1lKYAR67JHKu0b/BeWMxTfhDXOnpCectb3Ir3UzN2EGZ3lyTOqgWbPJObuz9HaIjw==; 5:EZP+0ee/ZJAyJMqev/Nbba2uF/DW36dHS5u1h3JV1gPGDsFH/MaCsn/vJpeTRr/oqZqQz238LalFC5LxerdiryPkzOrJLo858SXdGHw4/WctyclyvaMwFtHnaat0FQKV8IZUBAid6NXqUTBm9ejYi7HTezANvhbq2vfmSH7SW0s=; 7:jVk7ZRZIHa6ApHdsxG2XRyS590yBOp4NE2+9uE6/3jUe7HSszJGzyJDg+UnkxhHzMDihGRrpXHmJU43oYRMWg7l11U3MPMKkihzIIYuY2IiVnQLZ1FuDcxmPlAV8sRaX1uVj2X0cXAwkx0lgZ3aAklh9vSThBhAykONp4WPoP7H45LA0OuHqDDiou3NQcegcnu1HoKFCEZ/BFFCr/LLJCOrUeoi8ovAMsvbY7nY9SavzLQzyuukKwqn0jGS30j53 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 14:21:11.0575 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b5a060a-0ee7-4d7d-bf1c-08d5fe035c3d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2618 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.41.120 Subject: [Qemu-devel] [PATCH v5 0/5] qcow2: Take the image size into account when allocating the L2 cache X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This series makes the qcow2 L2 cache assignment aware of the image size, with the intention for it to cover the entire image. The importance of this change is in noticeable performance improvement, especially with heavy random I/O. The memory overhead is not big in most cases, as only 1 MB of cache for every 8 GB of image size is used. For cases with very large images and/or small cluster sizes, or systems with limited RAM resources, there is an upper limit on the default L2 cache: 32 MB. To modify this limit one can use the already existing 'l2-cache-size' and 'cache-size' options. Moreover, this fixes the behavior of 'l2-cache-size', as it was documented as the *maximum* L2 cache size, but in practice behaved as the absolute size. To compensate the memory overhead which may be increased following this behavior, the default cache-clean-interval is set to 10 minutes by default (was disabled by default before). The L2 cache is also resized accordingly, by default, if the image is resized. Additionally, few minor changes are made (refactoring and documentation fixes). Differences from v1: * .gitignore modification patch removed (unneeded). * The grammar fix in conflicting cache sizing patch removed (merged). * The update total_sectors when resizing patch squashed with the resizing patch. * L2 cache is now capped at 32 MB. * The default cache-clean-interval is set to 30 seconds. Differences from v2: * Made it clear in the documentation that setting cache-clean-interval to 0 disables this feature. Differences from v3: * The default cache-clean-interval is set to 10 minutes instead of 30 seconds before. * Commit message changes to better explain the patches. * Some refactoring. Differences from v4: * Refactoring. * Documentation and commit message fixes. Leonid Bloch (5): qcow2: Options' documentation fixes qcow2: Assign the L2 cache relatively to image size qcow2: Resize the cache upon image resizing qcow2: Set the default cache-clean-interval to 10 minutes qcow2: Explicit number replaced by a constant block/qcow2.c | 54 ++++++++++++++++++++------------------ block/qcow2.h | 5 ++-- docs/qcow2-cache.txt | 33 ++++++++++++++--------- qapi/block-core.json | 3 ++- qemu-options.hx | 11 +++++--- tests/qemu-iotests/137 | 1 - tests/qemu-iotests/137.out | 1 - 7 files changed, 61 insertions(+), 47 deletions(-)