From patchwork Wed Aug 8 22:11:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10560513 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 3B3AF13B4 for ; Wed, 8 Aug 2018 22:13:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AD612AF13 for ; Wed, 8 Aug 2018 22:13:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C5502B05E; Wed, 8 Aug 2018 22:13:29 +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 47A152AF13 for ; Wed, 8 Aug 2018 22:13:28 +0000 (UTC) Received: from localhost ([::1]:45679 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnWhq-0002RY-TQ for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Aug 2018 18:13:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnWgf-0002RA-Fx for qemu-devel@nongnu.org; Wed, 08 Aug 2018 18:12:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnWgb-00026L-GO for qemu-devel@nongnu.org; Wed, 08 Aug 2018 18:12:13 -0400 Received: from mail-co1nam03on0114.outbound.protection.outlook.com ([104.47.40.114]:31488 helo=NAM03-CO1-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 1fnWgb-00025R-3d; Wed, 08 Aug 2018 18:12:09 -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=eyCL4Uo+xzUX4zVK+lTyRVbMB8eWS/87rbvM4COwP/I=; b=mjK+AKW65Dgfwc7LUllW0J0qXq70Xi0cSSl3BRyhE5j1+AulvNjsnUe83DEKIYf2oeZLOUhE7QpMz5PAIgs4dAjoHtIyQur00OKh4YDB7eaHO95ekRBjFd9arA5RMgo7SSksd047SwxHJmb2lFb7NhIexuJioyrMzAPZEqGbZVI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2620.namprd07.prod.outlook.com (2a01:111:e400:c637::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Wed, 8 Aug 2018 22:12:03 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 01:11:33 +0300 Message-Id: <20180808221138.5770-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: AM0PR01CA0018.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::31) To CY1PR07MB2620.namprd07.prod.outlook.com (2a01:111:e400:c637::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 906d16da-926d-47fa-ca6b-08d5fd7bf956 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:CY1PR07MB2620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 3:CYoL5/1IEqadYVLtN5P6AUBZTShx9Jo30RAZqZEgeeDDMWNPRvw/k3Qm0oDxFa7nEuVsyVKtEay33/JRMHZDaB/oz8BC5Yjjv1dTlsN0BN2hr9J8hqJCbXjf+QXhLlrbVoySMNIeTt8XhcZgS/os10RvgcWMYQJyPqni9ljTwxxdqQ8XMcv0LDLl/ODGmYgop2Y6UfOuSqUx+gqicUqwRv3gqLxlSy1GFMSdA2o00f2uowPdLI9a4Z2+CiD4Uq2R; 25:u2KPD3FkdrOnBanXE7rho/lQCHl7Pnw2GLUUO/N9N5vpPKKr6WeH+x3t9/ONXAQ7/YfxuuLOfVOJrPt/PgT7xePNUI5yd5RrBe412NyYOicROlD4uBHOg1+iH+tXQagy/q9leL2IHMOlem98imDFu0k8tSBPKa9p99QmkAt2opnHJSk90tnjwzUbkXc3f/Wu3ilehXrYkXcY+wxu7eSGZ3BZLqdtLM/s9qxyk+MpvtPS8cpNpQEgk/GV2F/X0KIVI5uDyaloK0f0jkdaE1IlUMVX8XIvK6JHspQySK+XjUG5DkFSvxJXRYGU5ESaFhtcpmBHWeQXmPiNJPFyZvw6TQ==; 31:qLJ9arPC/9lChmfhEuh+IQC9JQuqmgVPW1xp+xcs99J3t6p5IclE8KsWFoRng/WFiO9IusFAvj5SwArgzoMqEZGsCSvUz4LWlxRS60221otH9TXByr7CWNvraMQA+nEP3e8tcOvREG1DJP2+/eNPBKplEuE0nUKfvffDYA/VFAi2dwuMPY5CJ/ZKea2bPUbs2JI9ZMKDiJjud68XgiGzOf4LPx2exQmcjOKQ57uxZBg= X-MS-TrafficTypeDiagnostic: CY1PR07MB2620: 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)(20161123564045)(20161123562045)(2016111802025)(20161123558120)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CY1PR07MB2620; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 4:97kYZEACCNrZuPx6qMlbupnqqb0ERsCYS8y6em2dCXbFjAxKC7kFeVP5uSk9NALN8/sAF4f3cWDsrwIpbt8Id38G9GNBt0SYSUppnCOxjuY5oWoyMMcdGfyUUPJ2v6q8c/3APSsaX+L6rhbL42uhfFy2ii+KAm9NQclNV00ZCLgkX5XLArh4vS0RLl+qedJNEbyxn2hvDVJDlzp539yx2TTmI1Ihj9PPJVB14Azh1AKQUIiZRGt7AEgNEqUNLnwR9/wowkEcToTwafLdBGQEXg== X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(346002)(366004)(376002)(39830400003)(396003)(136003)(189003)(199004)(52116002)(6506007)(386003)(106356001)(97736004)(53936002)(68736007)(2351001)(105586002)(186003)(66066001)(47776003)(14444005)(81166006)(8936002)(16526019)(2616005)(956004)(305945005)(6512007)(476003)(7736002)(81156014)(26005)(8676002)(486006)(51416003)(36756003)(86362001)(6486002)(50226002)(15650500001)(4326008)(107886003)(2361001)(50466002)(1076002)(478600001)(6916009)(6666003)(48376002)(6116002)(5660300001)(54906003)(16586007)(316002)(2906002)(3846002)(25786009); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2620; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts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iGs1s6rVgu6UT+9oPkCdXch/56fLeJ405S3qivDQ==; 5:rZKgElIJFCmDkyfWIwg6Olm8w0ohZ1D0tIpdXSJiq6alo8jS7yfB2LOufeS8bvWejIO1YFY7oMPKpwePi6/YAcapkiUQnmimmPjLMoS+qXSf9vwlxiVayX3HSAss/kLFQ2yKsz7yFDEvQKJQ/AAuFjzqw8Wz1MdhCu9BEt+41ds=; 7:xCyxYlgfKiS7xjF6JZi0lhzxVjyrz/GerIa+mG5tyqJUa6pDrSEDfkM88HMaYCPUopEtHrT3zf6eWbNUfIMFhA7dLBs+ht3ugOS5X8qFCTzWySTwcSob2J+ILCiHuUn+SZF9lyaodVvASmsuKpNvZ+NDVWlGOBXqco/k8OMoqSY027B7u6AU9wvQdBzLtAxXT3KZhGyGY5HrNKsqcHWKRX3KQMkyunTjo9CZ+e1ySWY42opLfSdS6OOFDOCKbIpi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 22:12:03.0577 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 906d16da-926d-47fa-ca6b-08d5fd7bf956 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2620 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.40.114 Subject: [Qemu-devel] [PATCH v4 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. 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 | 49 ++++++++++++++++++++------------------ block/qcow2.h | 5 ++-- docs/qcow2-cache.txt | 31 ++++++++++++++---------- qapi/block-core.json | 3 ++- qemu-options.hx | 11 +++++---- tests/qemu-iotests/137 | 1 - tests/qemu-iotests/137.out | 1 - 7 files changed, 56 insertions(+), 45 deletions(-)