On 07/24/2018 10:34 PM, Li RongQing wrote: > nf_ct_alloc_hashtable is used to allocate memory for conntrack, > NAT bysrc and expectation hashtable. Assuming 64k bucket size, > which means 7th order page allocation, __get_free_pages, called > by nf_ct_alloc_hashtable, will trigger the direct memory reclaim > and stall for a long time, when system has lots of memory stress ... > sz = nr_slots * sizeof(struct hlist_nulls_head); > - hash = (void *)__get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, > - get_order(sz)); > - if (!hash) > - hash = vzalloc(sz); > + hash = kvzalloc(sz, GFP_KERNEL); You could remove the @sz computation and call hash = kvcalloc(nr_slots, sizeof(struct hlist_nulls_head), GFP_KERNEL); Thanks to kvmalloc_array() check, you also could remove the : if (nr_slots > (UINT_MAX / sizeof(struct hlist_nulls_head))) return NULL; That would remove a lot of stuff now we have proper helpers. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html