From: Li Xiasong <lixiasong1@huawei.com> hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/9102 -------------------------------- get_rps_cpu() uses reciprocal_scale(hash, cpus_num - 1) when selecting RPS CPU indices for both NUMA and cluster policies. This excludes the last bucket from selection and introduces a persistent distribution bias. Use the full candidate count in reciprocal_scale() so all candidate CPUs can be selected uniformly, and keep boundary checks for invalid counts. Signed-off-by: Li Xiasong <lixiasong1@huawei.com> Signed-off-by: Yue Haibing <yuehaibing@huawei.com> --- net/venetcls/venetcls_flow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/venetcls/venetcls_flow.c b/net/venetcls/venetcls_flow.c index 9562dc9ae03c..bf8ce8a20d13 100644 --- a/net/venetcls/venetcls_flow.c +++ b/net/venetcls/venetcls_flow.c @@ -223,11 +223,11 @@ static inline u32 get_rps_cpu(u32 last_recv_cpu, u32 hash, int policy) if (policy == 1) { newcpu = cpumask_first(cpumask_of_node(cpu_to_node(last_recv_cpu))); - index = rps_cpus[reciprocal_scale(hash, rps_cpus_nums - 1)]; + index = rps_cpus[reciprocal_scale(hash, rps_cpus_nums)]; newcpu += index; } else if (policy == 2) { newcpu = cpumask_first(topology_cluster_cpumask(last_recv_cpu)); - index = cluster_rps_cpus[reciprocal_scale(hash, cluster_rps_cpus_nums - 1)]; + index = cluster_rps_cpus[reciprocal_scale(hash, cluster_rps_cpus_nums)]; newcpu += index; } else { newcpu = last_recv_cpu; -- 2.34.1