On 22.05.2025 10:48, Roger Pau Monne wrote:
> +bool flush_numa_node(const cpumask_t *mask, const void *va, unsigned int
> flags)
> +{
> + nodeid_t node = num_online_nodes() > 1 ? cpumask_to_node(mask)
> + : NUMA_NO_NODE;
> + struct arch_numa_node *info;
> +
> + if ( node == NUMA_NO_NODE )
> + return false;
One further question: Here you limit NUMA flushing to a single node, using
global flushes in all other cases. Did you consider extending this? Savings
ought to be had also when you want to e.g. flush on 2 out of 8 nodes. That
is, would it perhaps make sense to break up the file-scope flush_* variables
in smp.c altogether, using the NUMA approach uniformly?
> + info = node_info[node];
node_info[0] would then need populating from a static struct instance, of
course, and ...
> + if ( !info )
> + return false;
... such conditionals of course would need to go away. Then we'd also get
away without requiring yet another direct-APIC-vector, as ...
> + spin_lock(&info->flush_lock);
> + cpumask_and(&info->flush_mask, mask, &cpu_online_map);
> + cpumask_clear_cpu(smp_processor_id(), &info->flush_mask);
> + info->flush_va = va;
> + info->flush_flags = flags;
> + send_IPI_mask(&info->flush_mask, INVALIDATE_NUMA_VECTOR);
... INVALIDATE_TLB_VECTOR could then be used here.
Jan
> + while ( !cpumask_empty(&info->flush_mask) )
> + cpu_relax();
> + spin_unlock(&info->flush_lock);
> +
> + return true;
> +}