Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755263AbbHYGgL (ORCPT ); Tue, 25 Aug 2015 02:36:11 -0400 Received: from blu004-omc1s6.hotmail.com ([65.55.116.17]:50601 "EHLO BLU004-OMC1S6.hotmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754892AbbHYGgJ (ORCPT ); Tue, 25 Aug 2015 02:36:09 -0400 X-TMN: [9uvHsX3h/yoCdnAzMCWxDlyyMRIiSUhF9EyohFtIYHE=] X-Originating-Email: [wanpeng.li@hotmail.com] Message-ID: From: Wanpeng Li To: Paolo Bonzini CC: David Matlack , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Wanpeng Li Subject: [PATCH v2 0/3] KVM: Dynamic halt_poll_ns Date: Tue, 25 Aug 2015 14:35:16 +0800 X-Mailer: git-send-email 1.9.1 X-OriginalArrivalTime: 25 Aug 2015 06:36:07.0019 (UTC) FILETIME=[5275CBB0:01D0DF00] MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1850 Lines: 45 v1 -> v2: * change kvm_vcpu_block to read halt_poll_ns from the vcpu instead of the module parameter * use the shrink/grow matrix which is suggested by David * set halt_poll_ns_max to 2ms There is a downside of halt_poll_ns since poll is still happen for idle VCPU which can waste cpu usage. This patchset add the ability to adjust halt_poll_ns dynamically. There are two new kernel parameters for changing the halt_poll_ns: halt_poll_ns_grow and halt_poll_ns_shrink. A third new parameter, halt_poll_ns_max, controls the maximal halt_poll_ns; it is internally rounded down to a closest multiple of halt_poll_ns_grow. The shrink/grow matrix is suggested by David: if (poll successfully for interrupt): stay the same else if (length of kvm_vcpu_block is longer than halt_poll_ns_max): shrink else if (length of kvm_vcpu_block is less than halt_poll_ns_max): grow halt_poll_ns_shrink/ | halt_poll_ns_grow | grow halt_poll_ns | shrink halt_poll_ns ---------------------+----------------------+------------------- < 1 | = halt_poll_ns | = 0 < halt_poll_ns | *= halt_poll_ns_grow | /= halt_poll_ns_shrink otherwise | += halt_poll_ns_grow | -= halt_poll_ns_shrink Wanpeng Li (3): KVM: make halt_poll_ns per-VCPU KVM: dynamic halt_poll_ns adjustment KVM: trace kvm_halt_poll_ns grow/shrink include/linux/kvm_host.h | 1 + include/trace/events/kvm.h | 30 ++++++++++++++++++ virt/kvm/kvm_main.c | 78 ++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 106 insertions(+), 3 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/