Re: [PATCH v10 20/21] futex: Implement FUTEX2_NUMA

From: Peter Zijlstra
Date: Tue Mar 25 2025 - 18:56:17 EST


On Wed, Mar 26, 2025 at 01:22:19AM +0530, Shrikanth Hegde wrote:

> > + return &futex_queues[node][hash & futex_hashmask];

^^^^^^^

> > + hashsize = 256 * num_possible_cpus();
> > + hashsize /= num_possible_nodes();
>
> Wouldn't it be better to use num_online_nodes? each node may get a bigger
> hash bucket which means less collision no?

No. There are two problems with num_online_nodes, and both are evident
above.

Consider the case of a sparse set.