From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH v2 4/6] KVM: VMX: dynamise PLE window Date: Thu, 21 Aug 2014 13:47:40 +0200 Message-ID: <20140821114739.GC20546@potion.brq.redhat.com> References: <1408567997-21222-1-git-send-email-rkrcmar@redhat.com> <1408567997-21222-5-git-send-email-rkrcmar@redhat.com> <53F5ACCB.8000201@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Gleb Natapov , Raghavendra KT , Vinod Chegu , Hui-Zhi , Christian Borntraeger To: Paolo Bonzini Return-path: Content-Disposition: inline In-Reply-To: <53F5ACCB.8000201@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 2014-08-21 10:24+0200, Paolo Bonzini: > Il 20/08/2014 22:53, Radim Kr=C4=8Dm=C3=A1=C5=99 ha scritto: > > +static void update_ple_window_actual_max(void) > > +{ > > + ple_window_actual_max =3D > > + __shrink_ple_window(max(ple_window_max, ple_window), >=20 > Why the max() here? To have ple_window act as a ple_window_min as well. (When we are already preventing most stupid choices.) And it's cheap ... I can add comment to this function :) > > + ple_window_grow, INT_MIN); >=20 > This should be 0 (in fact you can probably make everything unsigned n= ow > that you've sorted out the overflows). Not in v2: val =3D min(vmx->ple_window, ple_window_actual_max); val +=3D ple_window_grow; vmx->ple_window =3D val; so we need to dip below zero to allow all possible grows. (I'm not sure if anyone is ever going to use the additive option, so getting rid of it is also a valid choice -- code would be nicer.)