Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753790AbbDNAtq (ORCPT ); Mon, 13 Apr 2015 20:49:46 -0400 Received: from mail-am1on0077.outbound.protection.outlook.com ([157.56.112.77]:50097 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754335AbbDNAtg (ORCPT ); Mon, 13 Apr 2015 20:49:36 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; Message-ID: <552C6410.1090105@ezchip.com> Date: Mon, 13 Apr 2015 20:49:20 -0400 From: Chris Metcalf User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Frederic Weisbecker CC: "Peter Zijlstra (Intel)" , "Paul E. McKenney" , "Rafael J. Wysocki" , Martin Schwidefsky , Ingo Molnar , Subject: Re: [PATCH v7 1/2] nohz: add tick_nohz_full_add_cpus_to() and _remove_cpus_from() APIs References: <20150410013702.GF18314@lerouge> <1428699232-7940-1-git-send-email-cmetcalf@ezchip.com> <20150414003346.GC6121@lerouge> In-Reply-To: <20150414003346.GC6121@lerouge> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [173.76.21.154] X-ClientProxiedBy: CO2PR11CA0009.namprd11.prod.outlook.com (10.141.242.147) To DB5PR02MB0775.eurprd02.prod.outlook.com (25.161.243.146) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR02MB0775;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR02MB1224; X-Microsoft-Antispam-PRVS: X-Forefront-Antispam-Report: BMV:1;SFV:NSPM;SFS:(10009020)(6049001)(6009001)(479174004)(51704005)(24454002)(377454003)(54356999)(87266999)(76176999)(36756003)(47776003)(65956001)(65816999)(23746002)(77156002)(62966003)(46102003)(575784001)(92566002)(86362001)(65806001)(2950100001)(66066001)(19580405001)(19580395003)(33656002)(50986999)(110136001)(15975445007)(77096005)(122386002)(50466002)(83506001)(42186005)(87976001)(4001350100001)(1411001)(117156001)(59896002)(21314002)(18886065003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR02MB0775;H:[192.168.1.160];FPR:;SPF:None;MLV:sfv;LANG:en; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(5002010);SRVR:DB5PR02MB0775;BCL:0;PCL:0;RULEID:;SRVR:DB5PR02MB0775; X-Forefront-PRVS: 054642504A X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2015 00:49:29.8683 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR02MB0775 X-OriginatorOrg: ezchip.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3198 Lines: 77 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? -- 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/