The gc scan+shrinking process can take a very long time. Add an upper ceiling: If we've queued up some elements for removal already give up after spending up to 10s on gc compaction. Note this intentionally doesn't add a call to cond_resched(); PREEMPT_NONE and _VOLUNTARY preemption models have been removed recently. Reported-by: Yiming Qian Fixes: 3c4287f62044 ("nf_tables: Add set type for arbitrary concatenation of ranges") Signed-off-by: Florian Westphal --- net/netfilter/nft_set_pipapo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c index d850166b8e45..0cd91f809655 100644 --- a/net/netfilter/nft_set_pipapo.c +++ b/net/netfilter/nft_set_pipapo.c @@ -1686,6 +1686,7 @@ static void nft_pipapo_gc_deactivate(struct net *net, struct nft_set *set, */ static void pipapo_gc_scan(struct nft_set *set, struct nft_pipapo_match *m) { + unsigned long stop_time = jiffies + 10 * HZ; struct nft_pipapo *priv = nft_set_priv(set); struct net *net = read_pnet(&set->net); unsigned int rules_f0, first_rule = 0; @@ -1697,6 +1698,9 @@ static void pipapo_gc_scan(struct nft_set *set, struct nft_pipapo_match *m) const struct nft_pipapo_field *f; unsigned int i, start, rules_fx; + if (priv->to_free && time_after(jiffies, stop_time)) + return; + start = first_rule; rules_fx = rules_f0; -- 2.52.0