From patchwork Thu Aug 9 21:52:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562089 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 4EF3414C0 for ; Thu, 9 Aug 2018 22:23:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B8FF2B407 for ; Thu, 9 Aug 2018 22:23:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2EBB92BBC6; Thu, 9 Aug 2018 22:23:39 +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 A3A2F2B407 for ; Thu, 9 Aug 2018 22:23:38 +0000 (UTC) Received: from localhost ([::1]:53221 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fntLF-0007uH-R6 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 18:23:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnst2-0004GM-5p for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnssy-0006VS-1s for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:28 -0400 Received: from mail-eopbgr700109.outbound.protection.outlook.com ([40.107.70.109]:22016 helo=NAM04-SN1-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 1fnssx-0006UJ-No; Thu, 09 Aug 2018 17:54:23 -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=5FOL4/BlGdOpGyUomjBEsGH+fB4A/6SqFw4m3RWe4hw=; b=NKVbdJW1FYLOdmfDYCs15c1hlH1qnVmfhR2rbkxhjpJ9KwwKUmkrCKrJrudsGSoVcYRbKUPEfd/5ZRT3vWuxZ1kImKGC1g5NWdau0wsQn39N2WgiX1cs/D54wS2SGVNXuHnT7/sX+dQn8+lNIqzzcsYSeBss7sRo4TlUcAKi580= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Thu, 9 Aug 2018 21:54:17 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 00:52:59 +0300 Message-Id: <20180809215307.18241-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: AM4PR0101CA0050.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::18) To CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1483cdb3-189d-4c05-fdea-08d5fe42a8be 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:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 3:30WHGOQOuczQUKHYrEPPju5QohCfh3M59rrdzoLChy+P2jhVD9QRpvvBInTvFXHSfP3cP4UKsra0ELp3kqVuj3l95o1Ad7XmGHL8d1rfRRIBINbMhUXR8SCXO79uIx3A3aYHZiMxdEp4Uh7N9vBVg5OmOBjSRoxGj8LNmeM4zXO/7/Bq0h+dtOFEaAF+4lRTobDyIcfCVl060OyBlGFiI6UhNhUJHoDBCCdGK7dMYeDsbGCbGOGvFfKM7U/wR9NA; 25:YgqFtRMGXo/zh2TUJzYmN8C1eV/L/jEZXLTGFjXaeAnWvrsk5FBcKlFBTJEG0CJbxfs9lAw7kECJP0Ue832T0P4A2QQ59JRDPNN0mXS9NVa8RzKvF6xdkXE3fY238879pKAkZf0qt68UBgXSmkLYZuIE2S/HgPxBFKPm77fxowE7kGNTWnq4ZDkZ+P80nOXeR3HBMJYhDPn/ez4xFAEo2hZz3Ao/ftR1ztvn7vaIX52gQflTOdyfAPUZuQYqElpXsBAC6YuLfZ1rHnZh+q8YV44TQzigAEQXOn5bSce/b5UOF0qdn+cVzPdihELJ528tPfWhJhXfgZjMLQnNFj5hFA==; 31:vKy0o8lHEqCqLyQzUJ+OQepZ16HQ5sEjeFJ4Ogw6r4GIy4xOeJLZraMm24Kweo/poP9aLbZcR+KGkvqaddzs5PQ+dES/JL0kFbWgdJL7WId2Lr0O/Ljnf4LSyfCXI8kG4DXMxkiH3V6InEFYC/WFyV9bl2iVTTpcqaEUKkRHnUdvJRioKXL/7kJmiPZlEiePNBDZbSiR7R4ny3h2UZ6Lb/n7408H4VBQwL1adiZeIck= X-MS-TrafficTypeDiagnostic: CO2PR07MB2615: 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)(20161123558120)(20161123564045)(2016111802025)(20161123560045)(20161123562045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CO2PR07MB2615; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 4:zPB3deq5rz/RhsEnaSxYxpC754j5xbee7vEnqRvlf1w6aHg4D7gRIM2cVrCYKGUiIPSmqTfZsAWpLHSzfprtl4qG5bAl1wWfA6F/KEbq/hMSbpeYAXnHAwy05u0KxoQQtlYsiR613mQyI7NKupw8P6fpR7vg1wvaVyqCiiZRkeLLPvgHhGL/JOhPs02RLorpIDvnolZGLRSHwIXbXUT/zHjHyjBJyTHHxM+EqfOTteKp4fzpbBWcJg7vHVzZM9FooWrsAbOyGtbmV2p33XDBCw== X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(346002)(396003)(136003)(39830400003)(366004)(199004)(189003)(486006)(2616005)(16526019)(86362001)(6486002)(7736002)(8936002)(16586007)(48376002)(478600001)(81156014)(68736007)(81166006)(186003)(476003)(26005)(305945005)(15650500001)(386003)(2906002)(8676002)(50466002)(50226002)(14444005)(956004)(25786009)(316002)(52116002)(51416003)(6116002)(6506007)(1076002)(3846002)(5660300001)(105586002)(6512007)(106356001)(6916009)(47776003)(36756003)(2351001)(4326008)(97736004)(53936002)(107886003)(66066001)(54906003)(2361001)(6666003); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2615; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: janustech.com does not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EnPeHvaQuq5aKuHrAdRYnnRleBfgk9iPafhCJPsGE0lGhqM9xvbwS2XBFi3cukZvxOfzDzGGCBnHtHspK1oWkaTlJv61yuZCxmODKXe+d+4MI/FCOdVxi8hKoJaKTSzhZATZmYdUg3dkLmYYmDJloF9GsK/uodT1cQ8RkUe3RmrIdGapSsUI53NadP4YhpiA7fOLM1sK9ZSjWmnNK7dcH9s6OlR+VN0OINM3PxhdbbgYIPzuLY+EfDt696WrkRg/SYo= X-Microsoft-Antispam-Message-Info: rwMo8GGBYPuqehyBihXrJ4zeQPdHWTJydJp9tu2dDw4z8PACxlKTgA9O8fhq2GUYHP/dSl9BV4JEpQ9O2AKthZofLlLPLnTayHmHCaupNavxs6XslV4SKFrEV4PT+8iqy2ikdurGa7vkn5nY/18v6poWTcaLqhR+XdqBjexlWjpEIi1UyeA2bechHhB4x4g3q0J5Wly3ddzfcXSkA028iOMRFYLP8dcfucLrm8aWxSJOeMYdARDGtOTnO2/tFTNskD1nGHXx96zD17L25+wBeZIOM/NPB/NxTydGm1pb8IJb2yDF1Fo20CGup3J+rIhB1yTUl6T5dKMejWe2ONdIxFd5T0f1vPIfZqT5PPfddfI= X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 6:pdjTF9i4TnVRviGqwQJc1/dCpqx8cAKVvBw2hNiamW++gt/w2ujfDNCyWwUTrZI8VugiSnwBAK56gBE4+g64OhQef5TcsuNa2vkGLEZyfekj0YfmSVHtAe2N/uWN8PcP+kWk64PIDfuJf1GwmQYlT16bcl55PVnkIg7al3vVD19C4+ifncc140shTPRG8DTXhP1g7jhFZZAo1wacjYJ272upDagtiHDgKRwkTcfsu+4IohVUXROHInRnw1m7LJMi1pAtjeCWl1T6iztwXlWlagaIbtqKlBZnYsVkI/1wLjInXH9zoNyXLBgvJLqddYEvN0ylfow3HD+O0hN0jch1AQNxzPaJ2SJBBapwnCvYXh6sWU6+CKtUPASERcbbtMrB4hka5StzgAdy548C6rdmQj8PcL6Vn7YwrCCnPg1T5XFMmNAxbQi/QasET6SjCacpWMEl+Q3Bx/EWrKC4k274ig==; 5:dIzSp7yTQRTLtbmC5nkAkUbSwDKaFQ9zu+k/RUPT6XDeJp4GvILaEbjdUuDagdqqPfwjAshmm/oe9744R5zZtAJMN1qgFCS51JfjTcH0BxutMdor2UGCuSg2u10sR+0vXZZ583+JkvvHzo833Nl/1sE6QQbw+Wj3m8Coq9bRvEg=; 7:ajp2j8U5mX8mfNPFgJtLbJB3qo/fJRlcx3dnRgcYXoqAMEg+hgTP8fL0uiUlk+D+chJU2+yBk7qtbNvQMKFA6//UYXPzXK5vuR4247lP8IeTZLF0LIGiT4roxY4kTiwDsXUAR1KP3gtbjCSDt+gPmZLE8gp6kq0F8UJc4NKgL8uq0keW76Ls2SRcOTD0dmfhqHi5/qn+eD4PMokrgj2vhpD+RyIqteYvYgjZAqzscx4jeZ244K8675rM6EuVFV++ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 21:54:17.4911 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1483cdb3-189d-4c05-fdea-08d5fe42a8be X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2615 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.70.109 Subject: [Qemu-devel] [PATCH v6 0/8] 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. Differences from v5: * A patch with cosmetic changes is split from the main patch * A patch for avoiding duplication in refcount cache size assignment is split from the main patch. * In the main patch the cap on the L2 cache size is set to only 1 MB (in order to be close to the previous behavior) and a separate patch sets it to 32 MB. * Changes in the documentation fixes patch [1/8]. Leonid Bloch (8): qcow2: Options' documentation fixes qcow2: Cosmetic changes qcow2: Avoid duplication in setting the refcount cache size qcow2: Assign the L2 cache relatively to the image size qcow2: Increase the default upper limit on the L2 cache 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, 62 insertions(+), 46 deletions(-)