Message ID | ZIEqlkIASx2F2DRF@tpad |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp598687vqr; Wed, 7 Jun 2023 18:30:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7qka7dgdN4yrmbbiECNceoY/ywCAp4vinbwIIVizt9nh35vDNYD6DnGjGqWZbZ0fVZO3/q X-Received: by 2002:a05:6a00:2186:b0:653:91c1:161c with SMTP id h6-20020a056a00218600b0065391c1161cmr5665940pfi.16.1686187849529; Wed, 07 Jun 2023 18:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686187849; cv=none; d=google.com; s=arc-20160816; b=f/N8s+Vzf5KK+5MeMqwrXvqe540BgMsyA2AspPGKBOvoZ8VqQdLMfEwNI+didVobjt fFbfCVBMPUQsb4xQDUWrZQfNt+xXFGwf7Z+38b532die7f9xdpcH7iT5fPYIojECKyij x/Sl6AkxLbOdRxzG6pspmAqJcCeyFbSP9c6KuPsEXobc1pykW0Sf1xKu9A3cUeI4sHQ0 TOCY4Rwazag4rtP4TVlgby99RMA3Mx+GDC1Jq/Mf2N+64kU3N+3HrC9mKy4l8BhvJiOe vtnMGqSbEC5wuBRxh8No4H+zE21Uc6LzvFHgBqbNhfFY0vMot9KrvI97TKdJH6doVwaf eGMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=ng32tWXL98UVNzodQ7JANpAeSKBoyfdr5bFpej8jqqg=; b=lE0ihsjKG6qPpOT+SVVubYcMzwb+1Hq813tlNhAJ8JMY9NdddqKVytm7zl/yE/jvFi 7XP6dQFHCgRrsfKOtEu6mXT2xa4fFYfINbHlg+Da/3c8jspEP617yBLk91swU9awJdmv x/bKZvcHxXOYggS6e21tbX6DE1djHGtVYvm8V3QOViSOVsLt0pu+w1EsNK2J+nXHnSRH gIxlfYa3UsUzxe4s+m2O2DxRLLvEX13cMXKVAIKmdGAF7KMjPCBTvZc8JydugzqumYJp GLXQY18GtkMG/tIEeOYCIubPKcgSquJTLVJCEWNDgzOxCoonSQcV+KHcZmZvqeqbqT4Y XU8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ORRq/TGT"; 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=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r16-20020a638f50000000b0053481d76f48si169509pgn.288.2023.06.07.18.30.36; Wed, 07 Jun 2023 18:30:49 -0700 (PDT) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ORRq/TGT"; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232932AbjFHBMg (ORCPT <rfc822;literming00@gmail.com> + 99 others); Wed, 7 Jun 2023 21:12:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232710AbjFHBMe (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 7 Jun 2023 21:12:34 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D00C26A4 for <linux-kernel@vger.kernel.org>; Wed, 7 Jun 2023 18:11:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686186707; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=ng32tWXL98UVNzodQ7JANpAeSKBoyfdr5bFpej8jqqg=; b=ORRq/TGTJy/WIsR1Xmh1emWdL3MbE6TAgb0fXo264PB9iCJ8Y5CjHUqEzupPGtMzFa7fx4 ODSfwp2VgB3pSCxi2pIfkPffjeSo7mOr/kiJqxDt/zgksYhpktgm0ccBH3xjtpUVCs5Ikq FhRUyxQlHRpDecWqoqa5et8bZyyuBCc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-290-fvbDl8aGMO26Vh-XVmcLYQ-1; Wed, 07 Jun 2023 21:11:42 -0400 X-MC-Unique: fvbDl8aGMO26Vh-XVmcLYQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED86F185A78B; Thu, 8 Jun 2023 01:11:41 +0000 (UTC) Received: from tpad.localdomain (ovpn-112-2.gru2.redhat.com [10.97.112.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9EFA0140E954; Thu, 8 Jun 2023 01:11:41 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id F223D40194A6F; Wed, 7 Jun 2023 22:10:46 -0300 (-03) Date: Wed, 7 Jun 2023 22:10:46 -0300 From: Marcelo Tosatti <mtosatti@redhat.com> To: Frederic Weisbecker <frederic@kernel.org> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>, Peter Zijlstra <peterz@infradead.org>, Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org Subject: [PATCH] sched/idle: disable tick in idle=poll idle entry Message-ID: <ZIEqlkIASx2F2DRF@tpad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768096110457723993?= X-GMAIL-MSGID: =?utf-8?q?1768096110457723993?= |
Series |
sched/idle: disable tick in idle=poll idle entry
|
|
Commit Message
Marcelo Tosatti
June 8, 2023, 1:10 a.m. UTC
Commit a5183862e76fdc25f36b39c2489b816a5c66e2e5
("tick/nohz: Conditionally restart tick on idle exit") allows
a nohz_full CPU to enter idle and return from it with the
scheduler tick disabled (since the tick might be undesired noise).
The idle=poll case still unconditionally restarts the tick when entering
idle.
To reduce the noise for that case as well, stop the tick when entering
idle, for the idle=poll case.
tick_nohz_idle_exit (called if the NEED_RESCHED bit is set)
is responsible for re-enabling the tick when necessary.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
---
Comments
On Wed, Jun 07, 2023 at 10:10:46PM -0300, Marcelo Tosatti wrote: > > Commit a5183862e76fdc25f36b39c2489b816a5c66e2e5 > ("tick/nohz: Conditionally restart tick on idle exit") allows > a nohz_full CPU to enter idle and return from it with the > scheduler tick disabled (since the tick might be undesired noise). > > The idle=poll case still unconditionally restarts the tick when entering > idle. > > To reduce the noise for that case as well, stop the tick when entering > idle, for the idle=poll case. > > tick_nohz_idle_exit (called if the NEED_RESCHED bit is set) > is responsible for re-enabling the tick when necessary. Who cares and why?
On Wed, Jun 07, 2023 at 10:10:46PM -0300, Marcelo Tosatti wrote: > > Commit a5183862e76fdc25f36b39c2489b816a5c66e2e5 > ("tick/nohz: Conditionally restart tick on idle exit") allows > a nohz_full CPU to enter idle and return from it with the > scheduler tick disabled (since the tick might be undesired noise). > > The idle=poll case still unconditionally restarts the tick when entering > idle. > > To reduce the noise for that case as well, stop the tick when entering > idle, for the idle=poll case. > > tick_nohz_idle_exit (called if the NEED_RESCHED bit is set) > is responsible for re-enabling the tick when necessary. > > Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> > > --- > > diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c > index 342f58a329f5..fdc240988ea9 100644 > --- a/kernel/sched/idle.c > +++ b/kernel/sched/idle.c > @@ -276,7 +276,7 @@ static void do_idle(void) > * idle as we know that the IPI is going to arrive right away. > */ > if (cpu_idle_force_poll || tick_check_broadcast_expired()) { > - tick_nohz_idle_restart_tick(); > + tick_nohz_idle_stop_tick(); > cpu_idle_poll(); cpu_idle_poll() re-enables interrupts and only checks need_resched(). If an interrupt happens and queues a new timer without waking up a task, the timer gets ignored. > } else { > cpuidle_idle_call(); >
On Thu, Jun 08, 2023 at 10:34:00AM +0200, Peter Zijlstra wrote: > On Wed, Jun 07, 2023 at 10:10:46PM -0300, Marcelo Tosatti wrote: > > > > Commit a5183862e76fdc25f36b39c2489b816a5c66e2e5 > > ("tick/nohz: Conditionally restart tick on idle exit") allows > > a nohz_full CPU to enter idle and return from it with the > > scheduler tick disabled (since the tick might be undesired noise). > > > > The idle=poll case still unconditionally restarts the tick when entering > > idle. > > > > To reduce the noise for that case as well, stop the tick when entering > > idle, for the idle=poll case. > > > > tick_nohz_idle_exit (called if the NEED_RESCHED bit is set) > > is responsible for re-enabling the tick when necessary. > > Who cares and why? Systems that use isolcpus/nohz_full, and use idle=poll to avoid sleeping. For example: https://github.com/intel/FlexRAN/blob/master/README.md More specifically, the case which HLTs (via nanosleep usually) is: https://www.isa.org/intech-home/2022/february-2022/departments/what-you-may-not-know-about-softplcs Can add this to the next version of the patch (unless you have any other comments). Thanks.
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 342f58a329f5..fdc240988ea9 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -276,7 +276,7 @@ static void do_idle(void) * idle as we know that the IPI is going to arrive right away. */ if (cpu_idle_force_poll || tick_check_broadcast_expired()) { - tick_nohz_idle_restart_tick(); + tick_nohz_idle_stop_tick(); cpu_idle_poll(); } else { cpuidle_idle_call();