提交 29c58472 编写于 作者: E Eric Dumazet 提交者: David S. Miller

net_sched: sch_fq: use hash_ptr()

When I wrote sch_fq.c, hash_ptr() on 64bit arches was awful,
and I chose hash_32().

Linus Torvalds and George Spelvin fixed this issue, so we can
use hash_ptr() to get more entropy on 64bit arches with Terabytes
of memory, and avoid the cast games.
Signed-off-by: NEric Dumazet <edumazet@google.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d30d9ccb
...@@ -245,7 +245,7 @@ static struct fq_flow *fq_classify(struct sk_buff *skb, struct fq_sched_data *q) ...@@ -245,7 +245,7 @@ static struct fq_flow *fq_classify(struct sk_buff *skb, struct fq_sched_data *q)
skb_orphan(skb); skb_orphan(skb);
} }
root = &q->fq_root[hash_32((u32)(long)sk, q->fq_trees_log)]; root = &q->fq_root[hash_ptr(sk, q->fq_trees_log)];
if (q->flows >= (2U << q->fq_trees_log) && if (q->flows >= (2U << q->fq_trees_log) &&
q->inactive_flows > q->flows/2) q->inactive_flows > q->flows/2)
...@@ -599,7 +599,7 @@ static void fq_rehash(struct fq_sched_data *q, ...@@ -599,7 +599,7 @@ static void fq_rehash(struct fq_sched_data *q,
kmem_cache_free(fq_flow_cachep, of); kmem_cache_free(fq_flow_cachep, of);
continue; continue;
} }
nroot = &new_array[hash_32((u32)(long)of->sk, new_log)]; nroot = &new_array[hash_ptr(of->sk, new_log)];
np = &nroot->rb_node; np = &nroot->rb_node;
parent = NULL; parent = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册