Re: [PATCH v10 20/21] futex: Implement FUTEX2_NUMA
From: Peter Zijlstra
Date: Tue Mar 25 2025 - 18:55:11 EST
On Wed, Mar 26, 2025 at 01:22:19AM +0530, Shrikanth Hegde wrote:
> > + if (node == FUTEX_NO_NODE) {
> > + /*
> > + * In case of !FLAGS_NUMA, use some unused hash bits to pick a
> > + * node -- this ensures regular futexes are interleaved across
> > + * the nodes and avoids having to allocate multiple
> > + * hash-tables.
> > + *
> > + * NOTE: this isn't perfectly uniform, but it is fast and
> > + * handles sparse node masks.
> > + */
> > + node = (hash >> futex_hashshift) % nr_node_ids;
> > + if (!node_possible(node)) {
> > + node = find_next_bit_wrap(node_possible_map.bits,
> > + nr_node_ids, node);
> > + }
> > + }
> > +
> > + return &futex_queues[node][hash & futex_hashmask];
>
> IIUC, when one specifies the numa node it can't be private futex anymore?
The futex can be private just fine. It just won't end up in the process
private hash, since that is a single mm wide hash.