From patchwork Tue Sep 18 15:29:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10604491 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 121FD15A6 for ; Tue, 18 Sep 2018 15:32:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 018942B37E for ; Tue, 18 Sep 2018 15:32:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9B7F2B3D2; Tue, 18 Sep 2018 15:32:37 +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 6647B2B37E for ; Tue, 18 Sep 2018 15:32:37 +0000 (UTC) Received: from localhost ([::1]:40866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2HzQ-00008A-Ih for patchwork-qemu-devel@patchwork.kernel.org; Tue, 18 Sep 2018 11:32:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2HxM-0007DM-TH for qemu-devel@nongnu.org; Tue, 18 Sep 2018 11:30:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2HxH-00043y-GX for qemu-devel@nongnu.org; Tue, 18 Sep 2018 11:30:28 -0400 Received: from mail-sn1nam01on0107.outbound.protection.outlook.com ([104.47.32.107]:28492 helo=NAM01-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 1g2HxH-0003aG-81; Tue, 18 Sep 2018 11:30: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=hq7Y39ay4+tmKH3XNGWuBvnQzMTyNsgM3UShWGP7rvQ=; b=AOalnVWDgCza/r0HBVaiDYiyYPeegZVWtZHWXHDXgTM+W5WfTlC+xSWNcBhxM8QqlopucvjcYW+iOycM+7STiy1Vu7k35G+1B+JZ9svS77pz+beiSUkTidUkwnqnrVWnkydRlAYEkyNGXcnRgtLaOuwJfavFcJMRD6YvGpIEEAs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2614.namprd07.prod.outlook.com (2603:10b6:102:14::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Tue, 18 Sep 2018 15:30:15 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Tue, 18 Sep 2018 18:29:20 +0300 Message-Id: <20180918152923.24824-7-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180918152923.24824-1-lbloch@janustech.com> References: <20180918152923.24824-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM5PR0701CA0016.eurprd07.prod.outlook.com (2603:10a6:203:51::26) To CO2PR07MB2614.namprd07.prod.outlook.com (2603:10b6:102:14::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5151db95-9b30-4d9a-6c15-08d61d7ba308 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989299)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:CO2PR07MB2614; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2614; 3:WP1QzLVzhvz/kH2Ww8BKYTh2lVjTlt/OO2bWUbZiwOYebrpfxkW0gDElDPcp72439UxmO/QgqhTrJ2dvu+Tpu59D6rqpBlxZh2MTsngwX/OBwelR1wSJSLwXkTRCcfO4SoiKEWlF1eCp2tac7uqSosckx7dKPvqx4gy7665Qxr03G14WQwZ+ncjnRfXjDAA1kA6NqxwYjv6i/enkHym1yA+zonFq6WTXCnRUARVwIvVI7Geevz/Mv0sJiDXiauuL; 25:Q1eZALiwr5vIwBck76XWL27VUqEOeTa53d/0ud2zb0dGiN5+Wz9gH9L3vzyCbUzez466jcoNGf6T19B7DbyiA9nFe8rErMLrRJYa6yen01goivub98HrTlgvx2OQ87hrZ5kSj4eiEDCcruN7v/i4gqM5utHZNNJJmBVcatbcOhovEYo1XT3IV8AWwlTwQva/0MUvMSXPTwPViqVA8U8gkaym/DkkuBBFs6Qe1ZHmgnyuWp38yGBGDy0lPexqYVN4oDN1H/C7czmq3RwKx3ntlLEepDJ0xTxAtBRyhk6i2FPtS0j20UCByKaG1IUdpYSdKuckxh8QDjr7qXmNNDK5Yw==; 31:TyXL8qvyiXkGWsQFKDh6fw/1AEyyDev6c4MgGuE5BCOR0oneMSfSTNLqUl922bWMLUab2zHmduhB6H/YUyaSbb7lj6v3SHqTnhHwPWbrz+XM7qgIL8SCNXEYWmmfBFJYQpmS4yWqOHt6KNvaeRyW9nkr25c7tWUYMnCjGXjJ6JLBM69rxhJSFi3qjBIucwd6/brZM5UrEm9x8Dk8snxUluG6vIcmaeswcwxnSGcKgx0= X-MS-TrafficTypeDiagnostic: CO2PR07MB2614: 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)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123560045)(20161123562045)(20161123558120)(2016111802025)(20161123564045)(6043046)(201708071742011)(7699050); SRVR:CO2PR07MB2614; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2614; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2614; 4:yg3m3K7GSx1jyTNN/6Mq6vWABBxzeNpeYawGpaxVjRISBSPQ/AdOaJJNimrdTloE+4Z9znMlX79D3quJyuDPdVC23AKzy0gGIdZxJwxB3Pbmi5XSiTw2wISrJyRay7U014e+0vh+HjrXQMB1tpkxlnlGHK1RzJKu2gv9MilVfvv9UGIKd7brHEg5sNjwmt5g7i5iORfC5eEmHedMij+Z8SsmjK/d6TKDhCyGd8iPh2bw2CApxHkJ5XpKjRr1EbxZQo53fsnizclnwSmX3A1VLw== X-Forefront-PRVS: 0799B1B2D7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(136003)(39830400003)(366004)(376002)(396003)(346002)(199004)(189003)(386003)(956004)(47776003)(36756003)(66066001)(6666003)(14444005)(68736007)(53936002)(5660300001)(6916009)(486006)(6486002)(8676002)(305945005)(8936002)(81166006)(81156014)(16586007)(54906003)(16526019)(446003)(476003)(316002)(11346002)(2616005)(186003)(6116002)(6512007)(7736002)(105586002)(52116002)(50466002)(86362001)(575784001)(76176011)(26005)(6506007)(97736004)(106356001)(50226002)(25786009)(48376002)(4326008)(107886003)(2351001)(2361001)(3846002)(508600001)(51416003)(2906002)(1076002); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2614; 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; CO2PR07MB2614; 23:A+f5oqpkPwzWXKUOuVzMijSmXmQoXyLh6XlWNRMxa?= Vf81/GXz7EK9F95WzhiU1oSQvyPmhxDayjepYgA7+jk+qTi+CGuFVFGlw6jTYh0MSlOJKrB/MjrKvaqZJH+E4/x3cWdwBOF5ptgzJpwf8+FAJFxL/0HrN6E6Zc1ZCLNFpq5Zei/tSZcsyQ8lFQCmI4babHQX/Z8A1Rzy6IZTMWFCou5gnqXdJCoiXGvp1pHTuu+D4Jllf6eixfLZLBeYEIdip8t/Ez6Y/8AfH0cwnMMKCwc3mlIUMOYNfAZ2tEviBL5NrzNluszc9syyCHjtP0/Gdlvf4faS2qSbCGOJxbJmTmB9MKSxBRax2l99hVRTyFQZXD3qb/EGx0j1uFldDXJoEZyoYSxtcLPhPZZ0Hn10U+KvnkSX/h1uuGdqtsIe0enfqQPEKL4hmVXmbUoe8Rus//zd/CXrINkkn0cxclSFPm9jOt8Y3idPMtt24F/6PFJYyiGFyyJtFW2liM2dZRcdJssiosQ69M945+ZBQfc0wDVBPwQLsobMJFuqBG5RmY1VKnBxO+g+2yhLCKioWiPMaYYBrkNrqBk7V0L/0TyUVG775/PKxeQDNsIk9qib3/T1JPpjNxHC7xX0nZXuzqblMc68xI/U/wrdMsORFWcqxK6iLXFV5HQ3wSn5D6jRHa2xR5s7or4HO3HW7BvgXMUW8EqC19WEFcTRhC5AMt5HMes096MJmhToIjD0RnV+1ZYtzZ136Pt7bF12VuaQ6+rgN0URqgOJu+PRv/nXdlQeEOgLsci2DQ0SlOMWEZYzg9o3V+lLnSJdpSUSF6UKwvSvak30iUQLhDp3+GmTqAHhre5Ef+/rzM5suyomiZ6o/80gmRMkYQS3kTOVMnpb64dNhlW0EFm2UWvbVoqw5KInOMM1/86npSfOXAamLBUNJuW33cR2N/qr/l9CFJFkHna4Z8gPBnjKrZ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90DvSt9LRvO7lzRKYYxmOR80HfPClTK9uEeo77cczvuPf71TpL9uWhV1zlBSUsUIEzgMyf2K7TUyfuebtcsBZQiFPmddm+KtqZdKhwVVh2dr7QxtfTAdhDxmqSECp7i503HnXnX+uYKdZI6t3wnOEQCIYzUw==; 5:4RlEEFKdPXM2m/AR0iFWcRh8zrKtRUE9KpBhR5Wh3wx9yIFGQ1U6i+7/jLJcrVVke35AYSRYKstJCvf000GfHjcb+NiRgk80IJVfL0i20Mnmh3zFKYRsajC1cLnyJhOzLjIwWwZC1PI33K4vLYciA2+7lpQDWd2Eu/sXivJzT0A=; 7:d3Z6jCc5rpp36E9+qpGD4VwQ4GQlVpVi/wV0p0EtbiuzBY/L9ZQ2FzqFW8V7+8uD8OB1s3sMNGzyl+Eh5P+gQBiaa6yLdAYlDXNAoaVkM7nC4KvXX2jRrR8LO26HuNe1ikYSiQqO8rSif5MD4oyFbJjsT53kobQHcPF2cXTF13065gzaA1yA8Zw7hbX2m6e8H3PTfuywUlWPs3rCDBZxSbxhLLP8QMnLjcVMcnFz1kxbe9XEXtzM3A/BdurPp3Uj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2018 15:30:15.3438 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5151db95-9b30-4d9a-6c15-08d61d7ba308 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2614 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.32.107 Subject: [Qemu-devel] [PATCH v9 6/9] qcow2: Increase the default upper limit on the L2 cache size 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 The upper limit on the L2 cache size is increased from 1 MB to 32 MB on Linux platforms, and to 8 MB on other platforms (this difference is caused by the ability to set intervals for cache cleaning on Linux platforms only). This is done in order to allow default full coverage with the L2 cache for images of up to 256 GB in size (was 8 GB). Note, that only the needed amount to cover the full image is allocated. The value which is changed here is just the upper limit on the L2 cache size, beyond which it will not grow, even if the size of the image will require it to. Signed-off-by: Leonid Bloch --- block/qcow2.h | 6 +++++- docs/qcow2-cache.txt | 15 +++++++++------ qemu-options.hx | 6 +++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/block/qcow2.h b/block/qcow2.h index 2f8c1fd15c..0f0e3534bf 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -74,7 +74,11 @@ /* Must be at least 4 to cover all cases of refcount table growth */ #define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */ -#define DEFAULT_L2_CACHE_MAX_SIZE S_1MiB +#ifdef CONFIG_LINUX +#define DEFAULT_L2_CACHE_MAX_SIZE S_32MiB +#else +#define DEFAULT_L2_CACHE_MAX_SIZE S_8MiB +#endif #define DEFAULT_CLUSTER_SIZE S_64KiB diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index c84cd69cc7..5965d3d094 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -124,12 +124,15 @@ There are a few things that need to be taken into account: - Both caches must have a size that is a multiple of the cluster size (or the cache entry size: see "Using smaller cache sizes" below). - - The maximum L2 cache size is 1 MB by default (enough for full coverage - of 8 GB images, with the default cluster size). This value can be - modified using the "l2-cache-size" option. QEMU will not use more memory - than needed to hold all of the image's L2 tables, regardless of this max. - value. The minimal L2 cache size is 2 clusters (or 2 cache entries, see - below). + - The maximum L2 cache size is 32 MB by default on Linux platforms (enough + for full coverage of 256 GB images, with the default cluster size). This + value can be modified using the "l2-cache-size" option. QEMU will not use + more memory than needed to hold all of the image's L2 tables, regardless + of this max. value. + On non-Linux platforms the maximal value is smaller by default (8 MB) and + this difference stems from the fact that on Linux the cache can be cleared + periodically if needed, using the "cache-clean-interval" option (see below). + The minimal L2 cache size is 2 clusters (or 2 cache entries, see below). - The default (and minimum) refcount cache size is 4 clusters. diff --git a/qemu-options.hx b/qemu-options.hx index f9fe43a4dc..d5f4bcadd4 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -746,9 +746,9 @@ The maximum total size of the L2 table and refcount block caches in bytes @item l2-cache-size The maximum size of the L2 table cache in bytes -(default: if cache-size is not specified - 1M; otherwise, as large as possible -within the cache-size, while permitting the requested or the minimal refcount -cache size) +(default: if cache-size is not specified - 32M on Linux platforms, and 8M on +non-Linux platforms; otherwise, as large as possible within the cache-size, +while permitting the requested or the minimal refcount cache size) @item refcount-cache-size The maximum size of the refcount block cache in bytes