Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932855AbbDNPfK (ORCPT ); Tue, 14 Apr 2015 11:35:10 -0400 Received: from mail-wg0-f50.google.com ([74.125.82.50]:36229 "EHLO mail-wg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932596AbbDNPfD (ORCPT ); Tue, 14 Apr 2015 11:35:03 -0400 Date: Tue, 14 Apr 2015 17:34:58 +0200 From: Frederic Weisbecker To: Chris Metcalf Cc: "Peter Zijlstra (Intel)" , "Paul E. McKenney" , "Rafael J. Wysocki" , Martin Schwidefsky , Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 1/2] nohz: add tick_nohz_full_add_cpus_to() and _remove_cpus_from() APIs Message-ID: <20150414153457.GC1781@lerouge> References: <20150410013702.GF18314@lerouge> <1428699232-7940-1-git-send-email-cmetcalf@ezchip.com> <20150414003346.GC6121@lerouge> <552C6410.1090105@ezchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <552C6410.1090105@ezchip.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3643 Lines: 83 On Mon, Apr 13, 2015 at 08:49:20PM -0400, Chris Metcalf wrote: > On 4/13/2015 8:33 PM, Frederic Weisbecker wrote: > >On Fri, Apr 10, 2015 at 04:53:51PM -0400, Chris Metcalf wrote: > >>The "removes_cpus_from" API is useful, for example, to modify a cpumask > >>to avoid the nohz cores so that interrupts aren't sent to them. > >> > >>Likewise the "add_cpus_to" API is useful to modify a cpumask indicating > >>some special nohz-type functionality so that the nohz cores are > >>automatically added to that set. > >> > >>Signed-off-by: Chris Metcalf > >>--- > >>[...] > >> > >>diff --git a/include/linux/tick.h b/include/linux/tick.h > >>index 9c085dc12ae9..8d1754c0f694 100644 > >>--- a/include/linux/tick.h > >>+++ b/include/linux/tick.h > >>@@ -186,6 +186,18 @@ static inline bool tick_nohz_full_cpu(int cpu) > >> return cpumask_test_cpu(cpu, tick_nohz_full_mask); > >> } > >>+static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) > >>+{ > >>+ if (tick_nohz_full_enabled()) > >>+ cpumask_or(mask, mask, tick_nohz_full_mask); > >>+} > >>+ > >>+static inline void tick_nohz_full_remove_cpus_from(struct cpumask *mask) > >>+{ > >>+ if (tick_nohz_full_enabled()) > >>+ cpumask_andnot(mask, mask, tick_nohz_full_mask); > >I would prefer that you don't introduce new APIs if they aren't used in your > >patchset. It seems that's the case for tick_nohz_full_remove_cpus_from(). > > Yes, it's used in a tile-tree patch to remove nohz_full cpus from the set that > take interrupts from the tilegx network driver. > > I can certainly make this patchset have just the _add_cpus_to() variant, > and the other patchset have just the _remove_cpus_from() variant. > It seemed to make sense to include them together as a matched set, > but doing it the way you suggest makes an equal if different amount of sense. > > >Also we have housekeeping_affine() that affines a task to CPUs outside the > >range of nohz full. In case you still need tick_nohz_full_remove_cpus_from() > >in a further patchset, housekeeping_affine_cpumask() would extend the existing > >naming. > > I like housekeeping_affine(), but it overwrites the affinity mask of > the task. So I would expect housekeeping_affine_mask() to overwrite > the specified argument cpumask, which it doesn't in my definition. > > I don't know that I can think of a good name in the "housekeeping_xxx" > namespace that feels better than the one I proposed. In context of the > proposed client of the API so far, it's: > > if (!network_cpus_init()) { > network_cpus_map = *cpu_online_mask; > tick_nohz_full_remove_cpus_from(&network_cpus_map); > } > > If housekeeping_mask were defined for non-nohz_full I could just use > it unconditionally here. Alternately I could just put in an #ifdef for > CONFIG_NO_HZ_FULL and either use cpu_only_mask or housekeeping_mask > to initialize network_cpus_map, which dodges the bullet of creating > an acceptable API name here for the moment. > > Frederic, what's your thought/preference? Right, the more I look into this whole, the more I think we should perhaps make tick_nohz_full_cpumask a read-only wide visible cpumask like we do for the cpumask in kernel/cpu.c defined as "const struct cpumask *const tick_nohz_full_mask" and do the cpumask operations with it. > > -- > Chris Metcalf, EZChip Semiconductor > http://www.ezchip.com > -- 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/