[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <xhsmhilkdw9sj.mognet@vschneid.remote.csb>
Date: Fri, 21 Oct 2022 15:06:36 +0100
From: Valentin Schneider <vschneid@...hat.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: netdev@...r.kernel.org, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org, Saeed Mahameed <saeedm@...dia.com>,
Leon Romanovsky <leon@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Yury Norov <yury.norov@...il.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Mel Gorman <mgorman@...e.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Heiko Carstens <hca@...ux.ibm.com>,
Tony Luck <tony.luck@...el.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Gal Pressman <gal@...dia.com>,
Tariq Toukan <tariqt@...dia.com>,
Jesse Brandeburg <jesse.brandeburg@...el.com>
Subject: Re: [PATCH v5 2/3] sched/topology: Introduce for_each_numa_hop_mask()
On 21/10/22 16:34, Andy Shevchenko wrote:
> On Fri, Oct 21, 2022 at 04:16:17PM +0300, Andy Shevchenko wrote:
>> On Fri, Oct 21, 2022 at 01:19:26PM +0100, Valentin Schneider wrote:
>
> ...
>
>> > +#define for_each_numa_hop_mask(mask, node) \
>> > + for (unsigned int __hops = 0; \
>> > + /* \
>> > + * Unsightly trickery required as we can't both initialize \
>> > + * @mask and declare __hops in for()'s first clause \
>> > + */ \
>> > + mask = __hops > 0 ? mask : \
>> > + node == NUMA_NO_NODE ? \
>> > + cpu_online_mask : sched_numa_hop_mask(node, 0), \
>> > + !IS_ERR_OR_NULL(mask); \
>>
>> > + __hops++, \
>> > + mask = sched_numa_hop_mask(node, __hops))
>>
>> This can be unified with conditional, see for_each_gpio_desc_with_flag() as
>> example how.
>
> Something like
>
> mask = (__hops || node != NUMA_NO_NODE) ? sched_numa_hop_mask(node, __hops) : cpu_online_mask
>
That does simplify things somewhat, thanks!
> --
> With Best Regards,
> Andy Shevchenko
Powered by blists - more mailing lists