Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4955228ybi; Tue, 30 Jul 2019 11:06:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoe4h9lggUZMPrTV21Cv6cHQvswccAVWUGUe6OLFJcCdd9bei50dN+No+zEa5XpEcxUBfw X-Received: by 2002:a63:5823:: with SMTP id m35mr111843310pgb.329.1564509980469; Tue, 30 Jul 2019 11:06:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564509980; cv=none; d=google.com; s=arc-20160816; b=faIQsKDnBiZ63QzzKKa8+6leaBVOp2tIWBcfhAPBbP0CTpP9G7Ffxek0p2QkYvzp+1 OmW1qXGmPYhpYvrKsB4OaN56q+WX2sH128uIGB3xwn05VGMdSSYxfXE2xz0vjRhRL7ma lACi9hfUNQ3hqZ0utUQxg8c24jg2Cmaulv13+i5McH04CB1B9JKLeQWZ4+nPfHuj8aY+ aav1460ntNaJCMoYdw2ap47ZwLOAJ3rZYJZiiIYriuvFJVFiTb6kDj4KXCS31nQvVm32 02znfb8HcCRekpd+pUIJW4nx2S97rb8a6VGI4fmfaGHUKWjOB77W+KwXiSMZxEjh2Ar+ c9Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=b7dlWlRtnf+39b9Vg/ffAJXjZk6ClrT7qqAvU401FUg=; b=QLXrV+7bRRWsNg3pBWoJXMapRK2aYr1RTSpLzEo61fvp+izgmVHNFFHt/eQGVH85Mi qfsq/PDbNDVeyqHK43iTaynHhXD7kWr0DjQ+OErMXlpLOIBKM+rLorUBf++p8sXQqlQL ELOp+U0r+7r0FydsrlcTzt2B8vUSB3dYRbA3451Sjnr7iIWZxh9PuS5imXEj71EaoutM /tY7h/2I0H55+eZoqto7NRSmpxSiZsjWh+gYxuJK7te3gn/9eaYCMoswKkaIoP74y6Az /KM1vsT8eK/Q/4KM/xJIvwWU+99xlogtUtUp36rGLKogxTLUthrGcFnhJstne/zrZ1f9 xO0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=O1oQy6Dc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si27787330plr.131.2019.07.30.11.06.05; Tue, 30 Jul 2019 11:06:20 -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; dkim=pass header.i=@kernel.org header.s=default header.b=O1oQy6Dc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727723AbfG3QnO (ORCPT + 99 others); Tue, 30 Jul 2019 12:43:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:54586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725974AbfG3QnO (ORCPT ); Tue, 30 Jul 2019 12:43:14 -0400 Received: from localhost (lfbn-ncy-1-174-150.w83-194.abo.wanadoo.fr [83.194.254.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E60E9206A2; Tue, 30 Jul 2019 16:43:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564504993; bh=mVaQfCUduyzwcuSDuf/0pHJrjsbowJ87qw05RgYyXQE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=O1oQy6DccGyY7TC6pRc2eJsnPfi+bdsqdoeupCCLYHUfH8LL82VRB2LxDHL0KRFo8 kUUS2tNQUSUFwzTP/ymVG0SoLI4y6HkFQDtNN6G7Ob10gxvkGlbdFziqGMIbeNJauF ciK3a8J5Mi8FUhh+W+FEiwGOy0RWKe8hTJAs8waY= Date: Tue, 30 Jul 2019 18:43:10 +0200 From: Frederic Weisbecker To: "Paul E. McKenney" Cc: fweisbec@gmail.com, tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, rcu@vger.kernel.org, peterz@infradead.org, paulmckrcu@gmail.com Subject: Re: How to turn scheduler tick on for current nohz_full CPU? Message-ID: <20190730164309.GA962@lenoir> References: <20190724115331.GA29059@linux.ibm.com> <20190724132257.GA1029@lenoir> <20190724135219.GY14271@linux.ibm.com> <20190724143012.GB1029@lenoir> <20190725011243.GZ14271@linux.ibm.com> <20190729223238.GF14271@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190729223238.GF14271@linux.ibm.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 29, 2019 at 03:32:38PM -0700, Paul E. McKenney wrote: > On Wed, Jul 24, 2019 at 06:12:43PM -0700, Paul E. McKenney wrote: > > The patch below (which includes your patch) does help considerably. > However, it does have some shortcomings: > > 1. Adds an atomic operation (albeit a cache-local one) to > the scheduler fastpath. One approach would be to have > a way of testing this bit and clearing it only if set. > > Another approach would be to instead clear it on the > transition to nohz_full userspace or to idle. Well, the latter would be costly as it is going to restart the tick on every user -> kernel transitions. > > 2. There are a lot of other places in the kernel that are in > need of this bit being set. I am therefore considering making > multi_cpu_stop() or its callers set this bit on all CPUs upon > entry and clear it upon exit. While in this state, it is > likely necessary to disable clearing this bit. Or it would > be necessary to make multi_cpu_stop() repeat clearing the bit > every so often. > > As it stands, I have CPU hotplug removal operations taking > more than 400 seconds. > > 3. It was tempting to ask for this bit to be tracked on a per-task > basis, but from what I can see that adds at least as much > complexity as it removes. Yeah I forgot to answer, you can use tick_dep_set_task() for that. > > Thoughts? > > Thanx, Paul > > PS. Outage on @linux.ibm.com, hence the CC of my gmail address. > > ------------------------------------------------------------------------ > > diff --git a/include/linux/tick.h b/include/linux/tick.h > index 196a0a7bfc4f..0dea6fb33a11 100644 > --- a/include/linux/tick.h > +++ b/include/linux/tick.h > @@ -108,7 +108,8 @@ enum tick_dep_bits { > TICK_DEP_BIT_POSIX_TIMER = 0, > TICK_DEP_BIT_PERF_EVENTS = 1, > TICK_DEP_BIT_SCHED = 2, > - TICK_DEP_BIT_CLOCK_UNSTABLE = 3 > + TICK_DEP_BIT_CLOCK_UNSTABLE = 3, > + TICK_DEP_BIT_RCU = 4 > }; > > #define TICK_DEP_MASK_NONE 0 > @@ -116,6 +117,7 @@ enum tick_dep_bits { > #define TICK_DEP_MASK_PERF_EVENTS (1 << TICK_DEP_BIT_PERF_EVENTS) > #define TICK_DEP_MASK_SCHED (1 << TICK_DEP_BIT_SCHED) > #define TICK_DEP_MASK_CLOCK_UNSTABLE (1 << TICK_DEP_BIT_CLOCK_UNSTABLE) > +#define TICK_DEP_MASK_RCU (1 << TICK_DEP_BIT_RCU) > > #ifdef CONFIG_NO_HZ_COMMON > extern bool tick_nohz_enabled; > @@ -258,6 +260,9 @@ static inline bool tick_nohz_full_enabled(void) { return false; } > static inline bool tick_nohz_full_cpu(int cpu) { return false; } > static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) { } > > +static inline void tick_nohz_dep_set_cpu(int cpu, enum tick_dep_bits bit) { } > +static inline void tick_nohz_dep_clear_cpu(int cpu, enum tick_dep_bits bit) { } And I gave you the wrong APIs. Please consider_using tick_dep_set_cpu() and tick_dep_clear_cpu() that first check if the CPU uses nohz_full. Those should have the !CONFIG_NO_HZ_FULL stub implemented as well. Thanks.