Lines Matching +full:foo +full:- +full:queue
1 // SPDX-License-Identifier: GPL-2.0-or-later
13 * - object w/ a bit
14 * - free list
18 * - explicit stack instead of recursion
19 * - tail recurse on first born instead of immediate push/pop
20 * - we gather the stuff that should not be killed into tree
25 * - don't just push entire root set; process in place
32 * of foo to bar and vice versa. Current code chokes on that.
38 * upon the beginning and unmark non-junk ones.
56 * parents (->gc_tree).
58 * Damn. Added missing check for ->dead in listen queues scanning.
97 spin_lock(&x->sk_receive_queue.lock); in scan_inflight()
98 skb_queue_walk_safe(&x->sk_receive_queue, skb, next) { in scan_inflight()
103 int nfd = UNIXCB(skb).fp->count; in scan_inflight()
104 struct file **fp = UNIXCB(skb).fp->fp; in scan_inflight()
106 while (nfd--) { in scan_inflight()
113 /* Ignore non-candidates, they could in scan_inflight()
117 if (test_bit(UNIX_GC_CANDIDATE, &u->gc_flags)) { in scan_inflight()
125 __skb_unlink(skb, &x->sk_receive_queue); in scan_inflight()
130 spin_unlock(&x->sk_receive_queue.lock); in scan_inflight()
136 if (x->sk_state != TCP_LISTEN) { in scan_children()
147 spin_lock(&x->sk_receive_queue.lock); in scan_children()
148 skb_queue_walk_safe(&x->sk_receive_queue, skb, next) { in scan_children()
149 u = unix_sk(skb->sk); in scan_children()
151 /* An embryo cannot be in-flight, so it's safe in scan_children()
154 BUG_ON(!list_empty(&u->link)); in scan_children()
155 list_add_tail(&u->link, &embryos); in scan_children()
157 spin_unlock(&x->sk_receive_queue.lock); in scan_children()
161 scan_inflight(&u->sk, func, hitlist); in scan_children()
162 list_del_init(&u->link); in scan_children()
169 atomic_long_dec(&usk->inflight); in dec_inflight()
174 atomic_long_inc(&usk->inflight); in inc_inflight()
179 atomic_long_inc(&u->inflight); in inc_inflight_move_tail()
184 if (test_bit(UNIX_GC_MAYBE_CYCLE, &u->gc_flags)) in inc_inflight_move_tail()
185 list_move_tail(&u->link, &gc_candidates); in inc_inflight_move_tail()
218 * in-flight sockets are considered, and from those only ones in unix_gc()
229 * added to queue, so we must make sure only to touch in unix_gc()
236 total_refs = file_count(u->sk.sk_socket->file); in unix_gc()
237 inflight_refs = atomic_long_read(&u->inflight); in unix_gc()
242 list_move_tail(&u->link, &gc_candidates); in unix_gc()
243 __set_bit(UNIX_GC_CANDIDATE, &u->gc_flags); in unix_gc()
244 __set_bit(UNIX_GC_MAYBE_CYCLE, &u->gc_flags); in unix_gc()
248 /* Now remove all internal in-flight reference to children of in unix_gc()
252 scan_children(&u->sk, dec_inflight, NULL); in unix_gc()
266 list_move(&cursor, &u->link); in unix_gc()
268 if (atomic_long_read(&u->inflight) > 0) { in unix_gc()
269 list_move_tail(&u->link, ¬_cycle_list); in unix_gc()
270 __clear_bit(UNIX_GC_MAYBE_CYCLE, &u->gc_flags); in unix_gc()
271 scan_children(&u->sk, inc_inflight_move_tail, NULL); in unix_gc()
282 scan_children(&u->sk, inc_inflight, &hitlist); in unix_gc()
289 __clear_bit(UNIX_GC_CANDIDATE, &u->gc_flags); in unix_gc()
290 list_move_tail(&u->link, &gc_inflight_list); in unix_gc()