Received: by 10.213.65.68 with SMTP id h4csp820009imn; Wed, 28 Mar 2018 13:26:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx49vtjM3miSnTTeqqF7NiXROuKbmQvC0iMxcACH0XSWXAbXUkNL3vDZjktj32j1qDIZAGLKF X-Received: by 10.101.97.205 with SMTP id j13mr3482586pgv.266.1522268803146; Wed, 28 Mar 2018 13:26:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522268803; cv=none; d=google.com; s=arc-20160816; b=c6dWwPHWiJ1ofqgGCQ+51COBVDO93v102W34JWWqyebKcJq3sybKDNS9cCqlBoXUif klvJBWBecDQKTqc8LlgzwUBon7VLg4IW2LkB34tSq0QTuNyvoP6i1CGrrqD+/lpMFs2Q oidmEe/BCUWzxhdbpeKKRjosBRziH4LpphePChSGiB2IRWgHIGi29SVuPIEVh0tYese3 zPopn54iAVE/XCCHwe6a+GC63i4Fgfly2IlVXuwJtoKcwdRFgLRnx7j6IAFszyvQdreo CncpaOT05H5gwv1QrQ1zMjyc1O8cfaUEVB5w7skgvzhNvVk/D9t0fg1HgNzIG0b6+gaW zqVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=c0d00YPF6Ly5ZwX6R+TcTvWs5yvpnymTw+jUZB28EfM=; b=qsaYtKORNatmW7AW9li8WrrlEsX5gTNYsQ9bi6lAwBnrYgQ+NVebqtSxkmCAuU3w8n xaKpKdJwTaamF16NRVbii8PFOlnQsUFTf8oN/vC/L2dY5tXiOtnQ56ruyxsTqTvcUi4I G6fKMK8g8mCkekccfOz3+iVL+ijI6VOl5FqawMUcgUoUDMvC6t5tRtUfYKbAJVlimn3I AcQeUdVZPZWCClEyWIpGnpcFLA7vzDy7KeLHM9jh1z8ZIdZC25hwwyYKDnM1h0G22QNM 9WAHYJ5DOZAXAd2iPZWJNN2xEyBy8dqt2IeDNA3Nqp0TMNGMV6mLaS7tZ8Yucfn6HTUN 1uiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w66si3278060pfb.198.2018.03.28.13.26.28; Wed, 28 Mar 2018 13:26:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753228AbeC1UZD (ORCPT + 99 others); Wed, 28 Mar 2018 16:25:03 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48646 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752318AbeC1UZC (ORCPT ); Wed, 28 Mar 2018 16:25:02 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CD9414068035; Wed, 28 Mar 2018 20:25:01 +0000 (UTC) Received: from flask (unknown [10.43.2.80]) by smtp.corp.redhat.com (Postfix) with SMTP id 81F9E7C3E; Wed, 28 Mar 2018 20:24:58 +0000 (UTC) Received: by flask (sSMTP sendmail emulation); Wed, 28 Mar 2018 22:24:57 +0200 Date: Wed, 28 Mar 2018 22:24:57 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Babu Moger Cc: joro@8bytes.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, pbonzini@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/5] KVM: VMX: Remove ple_window_actual_max Message-ID: <20180328202457.GI26753@flask> References: <1521232646-79580-1-git-send-email-babu.moger@amd.com> <1521232646-79580-3-git-send-email-babu.moger@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1521232646-79580-3-git-send-email-babu.moger@amd.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 28 Mar 2018 20:25:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 28 Mar 2018 20:25:02 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'rkrcmar@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-03-16 16:37-0400, Babu Moger: > Get rid of ple_window_actual_max, because its benefits are really > minuscule and the logic is complicated. > > The overflows(and underflow) are controlled in __ple_window_grow > and _ple_window_shrink respectively. > > Suggested-by: Radim Krčmář > Signed-off-by: Babu Moger > --- > arch/x86/kvm/vmx.c | 22 +--------------------- > 1 file changed, 1 insertion(+), 21 deletions(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > @@ -178,7 +178,6 @@ > module_param(ple_window_shrink, uint, 0444); > > /* Default is to compute the maximum so we can never overflow. */ > -static uint ple_window_actual_max = KVM_VMX_DEFAULT_PLE_WINDOW_MAX; > static uint ple_window_max = KVM_VMX_DEFAULT_PLE_WINDOW_MAX; > module_param(ple_window_max, uint, 0444); > > @@ -6645,14 +6644,12 @@ static uint __grow_ple_window(uint val) > if (ple_window_grow < 1) > return ple_window; > > - val = min(val, ple_window_actual_max); > - > if (ple_window_grow < ple_window) > val *= ple_window_grow; > else > val += ple_window_grow; > > - return val; > + return min(val, ple_window_max); I added a bit of logic to avoid wraparounds.