Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39017C4332F for ; Wed, 1 Dec 2021 15:47:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351193AbhLAPuH (ORCPT ); Wed, 1 Dec 2021 10:50:07 -0500 Received: from vps-vb.mhejs.net ([37.28.154.113]:46354 "EHLO vps-vb.mhejs.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351093AbhLAPtM (ORCPT ); Wed, 1 Dec 2021 10:49:12 -0500 Received: from MUA by vps-vb.mhejs.net with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1msRnQ-0008GM-47; Wed, 01 Dec 2021 16:45:24 +0100 To: Sean Christopherson Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Igor Mammedov , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Christian Borntraeger , Janosch Frank , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandru Elisei , Atish Patra , Ben Gardon , kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <74663af27fd6e25b7846da343f7013b1e9885a4b.1638304316.git.maciej.szmigiero@oracle.com> From: "Maciej S. Szmigiero" Subject: Re: [PATCH v6 18/29] KVM: x86: Use nr_memslot_pages to avoid traversing the memslots array Message-ID: <54e434b1-2bbd-d6ad-7b35-5b9b9aeea2f3@maciej.szmigiero.name> Date: Wed, 1 Dec 2021 16:45:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01.12.2021 03:21, Sean Christopherson wrote: > On Tue, Nov 30, 2021, Maciej S. Szmigiero wrote: >> From: "Maciej S. Szmigiero" >> >> There is no point in recalculating from scratch the total number of pages >> in all memslots each time a memslot is created or deleted. Use KVM's >> cached nr_memslot_pages to compute the default max number of MMU pages. >> >> Note that even with nr_memslot_pages capped at ULONG_MAX we can't safely >> multiply it by KVM_PERMILLE_MMU_PAGES (20) since this operation can >> possibly overflow an unsigned long variable. >> >> Write this "* 20 / 1000" operation as "/ 50" instead to avoid such >> overflow. >> >> Signed-off-by: Maciej S. Szmigiero >> [sean: use common KVM field and rework changelog accordingly] >> Signed-off-by: Sean Christopherson > > My SoB can definitely be dropped for this one, just consider it review feedback > that happened to have an SoB attached. > > Reviewed-by: Sean Christopherson > ...and on this one, too. Thanks, Maciej