|
11 | 11 | */
|
12 | 12 | #include <linux/compat.h>
|
13 | 13 | #include <linux/compiler.h>
|
14 |
| -#include <linux/hash.h> |
15 | 14 | #include <linux/init.h>
|
| 15 | +#include <linux/jhash.h> |
16 | 16 | #include <linux/interrupt.h>
|
17 | 17 | #include <linux/list.h>
|
18 | 18 | #include <linux/memblock.h>
|
@@ -47,11 +47,11 @@ struct timer_hash_bucket {
|
47 | 47 |
|
48 | 48 | static struct {
|
49 | 49 | struct timer_hash_bucket *buckets;
|
50 |
| - unsigned long bits; |
| 50 | + unsigned long mask; |
51 | 51 | } __timer_data __ro_after_init __aligned(2*sizeof(long));
|
52 | 52 |
|
53 | 53 | #define timer_buckets (__timer_data.buckets)
|
54 |
| -#define timer_hashbits (__timer_data.bits) |
| 54 | +#define timer_hashmask (__timer_data.mask) |
55 | 55 |
|
56 | 56 | static const struct k_clock * const posix_clocks[];
|
57 | 57 | static const struct k_clock *clockid_to_kclock(const clockid_t id);
|
@@ -87,7 +87,7 @@ DEFINE_CLASS_IS_COND_GUARD(lock_timer);
|
87 | 87 |
|
88 | 88 | static struct timer_hash_bucket *hash_bucket(struct signal_struct *sig, unsigned int nr)
|
89 | 89 | {
|
90 |
| - return &timer_buckets[hash_32(hash32_ptr(sig) ^ nr, timer_hashbits)]; |
| 90 | + return &timer_buckets[jhash2((u32 *)&sig, sizeof(sig) / sizeof(u32), nr) & timer_hashmask]; |
91 | 91 | }
|
92 | 92 |
|
93 | 93 | static struct k_itimer *posix_timer_by_id(timer_t id)
|
@@ -1513,7 +1513,7 @@ static int __init posixtimer_init(void)
|
1513 | 1513 | timer_buckets = alloc_large_system_hash("posixtimers", sizeof(*timer_buckets),
|
1514 | 1514 | size, 0, 0, &shift, NULL, size, size);
|
1515 | 1515 | size = 1UL << shift;
|
1516 |
| - timer_hashbits = ilog2(size); |
| 1516 | + timer_hashmask = size - 1; |
1517 | 1517 |
|
1518 | 1518 | for (i = 0; i < size; i++) {
|
1519 | 1519 | spin_lock_init(&timer_buckets[i].lock);
|
|
0 commit comments