.. | .. |
---|
170 | 170 | * we borrow their wisdom about good table sizes on different systems |
---|
171 | 171 | * dependent on RAM. This calculation here comes from there. |
---|
172 | 172 | */ |
---|
173 | | - table_size = (totalram_pages > (1U << 30) / PAGE_SIZE) ? 8192 : |
---|
| 173 | + table_size = (totalram_pages() > (1U << 30) / PAGE_SIZE) ? 8192 : |
---|
174 | 174 | max_t(unsigned long, 16, roundup_pow_of_two( |
---|
175 | | - (totalram_pages << PAGE_SHIFT) / |
---|
| 175 | + (totalram_pages() << PAGE_SHIFT) / |
---|
176 | 176 | (1U << 14) / sizeof(struct hlist_head))); |
---|
177 | 177 | max_entries = table_size * 8; |
---|
178 | 178 | |
---|
179 | | - table_v4 = kvzalloc(table_size * sizeof(*table_v4), GFP_KERNEL); |
---|
| 179 | + table_v4 = kvcalloc(table_size, sizeof(*table_v4), GFP_KERNEL); |
---|
180 | 180 | if (unlikely(!table_v4)) |
---|
181 | 181 | goto err_kmemcache; |
---|
182 | 182 | |
---|
183 | 183 | #if IS_ENABLED(CONFIG_IPV6) |
---|
184 | | - table_v6 = kvzalloc(table_size * sizeof(*table_v6), GFP_KERNEL); |
---|
| 184 | + table_v6 = kvcalloc(table_size, sizeof(*table_v6), GFP_KERNEL); |
---|
185 | 185 | if (unlikely(!table_v6)) { |
---|
186 | 186 | kvfree(table_v4); |
---|
187 | 187 | goto err_kmemcache; |
---|