Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp976961rwb; Wed, 7 Dec 2022 07:15:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ObBuJwK1i77DzV7MXvoNVMqAk5vbGiorSQmWMj8iXbFZP9hbdsQYTg81iDq6ICo2+eXGa X-Received: by 2002:a63:210d:0:b0:43c:1cb8:73ba with SMTP id h13-20020a63210d000000b0043c1cb873bamr64400492pgh.11.1670426136422; Wed, 07 Dec 2022 07:15:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670426136; cv=none; d=google.com; s=arc-20160816; b=0lOpkUTCm+Zit+lcOG8wqldXsFyvaRtSrhrfNkL18aVt6Elfiogz+1QMn+V3wKRF6k x4d18yvbmu3TMo8Cf8oacbVqYKyL+SzecjxQSlJq/iVl9Kimph+BGQj3zhBmGXw9UBVQ M3kTq72AhO593AG5XcGFpQl4RDBYNy1i1Z/vm9H0n8JYOVjactj46PVOu3GvvSGuWinX qPqt2eKGMvlgOLAHq7cL9ihb53wPAPfwpRUfzD58mA99Gp3MCfw2lM0lpj3TZKFn6ohM rMA8lRby9xGQDJUKS9LYCa6nOUonHTlwbwa2EqVMaa29///PoKtrQJLpVyomCUjfBHK6 8sKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=5taqlCVSBSBpZvPjZD+3+7kbvDpWqxTM95A9eF8jh5A=; b=LXmD+OPMagRmakO3+auAqhk4wrr3laOr/y+gp96yBDHIG28qPnZ1oQpn8zt/yPbQpN nFX/vgSLRd2yk9ChAzTXD2e86tsBIqRs3ey9ncZD3dvl9+D1Js505FULJP6jku9ehIb7 UxuTFC4Vh6YZD4IrxWj+pbGueL57/pHbW3N68FqrdiFTDL9Kp7ZkObl+m7Uf43lDmZBf G2VDSb5gSvCfaluPi+RfrzmTCWiH6QeW3QUyfZtrLIHbbmYgX8CokzfvLdP3GYGfjFMH etnhSE7IBudEgXnz9nHed0C8aAOfpUe7ckFwk0t9SjZVMkK7P934TgRVyBDqHT9SP/kK OX2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t191-20020a6381c8000000b00478701e57c8si20189091pgd.807.2022.12.07.07.15.25; Wed, 07 Dec 2022 07:15:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229942AbiLGOiF (ORCPT + 77 others); Wed, 7 Dec 2022 09:38:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbiLGOh6 (ORCPT ); Wed, 7 Dec 2022 09:37:58 -0500 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 169935FBB6; Wed, 7 Dec 2022 06:37:55 -0800 (PST) Received: by mail-qk1-f169.google.com with SMTP id z17so10078172qki.11; Wed, 07 Dec 2022 06:37:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5taqlCVSBSBpZvPjZD+3+7kbvDpWqxTM95A9eF8jh5A=; b=Ag/o/tlh4QhAnOahLuEIqRh1MGlt5v28rqOL0ClykKbt40gmG7JQD2whmDvDlIfsaW ZYiDfGz2SJQV2eeODb1aR2ZncsTnteSwzzmaDqblAcqMJPvPeqDEwgclTEs11jm/pTdD zXLkVGHfn3PwztnlAiBMQsvkqavXOE53MULmYU/aLN4hpd9PRjNl3Smfkumgs/BL93Da 4+vGUrM+Jp9sJhhTyGdavHK9RxkYdvtVdUctwuLoTywvucCk4bBsYE+3dRiAhCckplm3 F6oYgW0diu/sdK6iEFkEBf/ZnK1aAQGY+b4aQMKD3Vq1GV/nIFOYgRbtuLJyDcgc1dax nFgw== X-Gm-Message-State: ANoB5pmvu64tz9OeSCYlC9qObgEWOT7Py0iACpWNvNuecUxXTGxPNvI7 PAXO03ir5dEbPZlRQlUQ5qZD5Wghdiara5+NB/Ul8Vnz X-Received: by 2002:a05:620a:4611:b0:6fa:af7e:927c with SMTP id br17-20020a05620a461100b006faaf7e927cmr78745245qkb.443.1670423874205; Wed, 07 Dec 2022 06:37:54 -0800 (PST) MIME-Version: 1.0 References: <1670416895-50172-1-git-send-email-lirongqing@baidu.com> In-Reply-To: <1670416895-50172-1-git-send-email-lirongqing@baidu.com> From: "Rafael J. Wysocki" Date: Wed, 7 Dec 2022 15:37:43 +0100 Message-ID: Subject: Re: [PATCH 1/2][v2] cpuidle-haltpoll: Replace default_idle with arch_cpu_idle To: lirongqing@baidu.com Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, rafael@kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, akpm@linux-foundation.org, tony.luck@intel.com, jpoimboe@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 7, 2022 at 1:42 PM wrote: > > From: Li RongQing > > When KVM guest has MWAIT and mwait_idle is used as default idle function, > but once cpuidle-haltpoll is loaded, default_idle in default_enter_idle is > used, which is using HLT, and cause a performance regression. As the commit > aebef63cf7ff ("x86: Remove vendor checks from prefer_mwait_c1_over_halt") > explains that mwait is preferred > > so replace default_idle with arch_cpu_idle which can using MWAIT > optimization. > > latency of sockperf ping-pong localhost test is reduced by more 20% > unixbench has 5% performance improvements for single core > > Suggested-by: Thomas Gleixner > Suggested-by: Rafael J. Wysocki > Signed-off-by: Li RongQing > --- > arch/x86/kernel/process.c | 1 + > drivers/cpuidle/cpuidle-haltpoll.c | 2 +- > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c > index c21b734..303afad 100644 > --- a/arch/x86/kernel/process.c > +++ b/arch/x86/kernel/process.c > @@ -721,6 +721,7 @@ void arch_cpu_idle(void) > { > x86_idle(); > } > +EXPORT_SYMBOL(arch_cpu_idle); Why do you need this export at all? > > /* > * We use this if we don't have any better idle routine.. > diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c > index 3a39a7f..e66df22 100644 > --- a/drivers/cpuidle/cpuidle-haltpoll.c > +++ b/drivers/cpuidle/cpuidle-haltpoll.c > @@ -32,7 +32,7 @@ static int default_enter_idle(struct cpuidle_device *dev, > local_irq_enable(); > return index; > } > - default_idle(); > + arch_cpu_idle(); > return index; > } > > -- > 2.9.4 >