/linux/Documentation/translations/zh_CN/core-api/ |
H A D | kref.rst | 41 struct kref refcount; 58 kref_init(&data->refcount); 70 kref_get(&data->refcount); 77 kref_put(&data->refcount, data_release); 91 struct my_data *data = container_of(ref, struct my_data, refcount); 101 kref_put(&data->refcount, data_release); 112 kref_init(&data->refcount); 114 kref_get(&data->refcount); 118 kref_put(&data->refcount, data_release); 126 kref_put(&data->refcount, data_releas [all...] |
/linux/include/linux/ |
H A D | kref.h | 17 #include <linux/refcount.h> 20 refcount_t refcount; member 23 #define KREF_INIT(n) { .refcount = REFCOUNT_INIT(n), } 31 refcount_set(&kref->refcount, 1); in kref_init() 36 return refcount_read(&kref->refcount); in kref_read() 40 * kref_get - increment refcount for object. 45 refcount_inc(&kref->refcount); in kref_get() 49 * kref_put - Decrement refcount for object 54 * Decrement the refcount, and if 0, call @release. The caller may not 64 if (refcount_dec_and_test(&kref->refcount)) { in kref_put() [all...] |
/linux/drivers/gpu/drm/amd/display/dc/core/ |
H A D | dc_surface.c | 94 kref_init(&plane_state->refcount); in dc_create_plane_state() 164 kref_get(&plane_state->refcount); in dc_plane_state_retain() 169 struct dc_plane_state *plane_state = container_of(kref, struct dc_plane_state, refcount); in dc_plane_state_free() 176 kref_put(&plane_state->refcount, dc_plane_state_free); in dc_plane_state_release() 181 kref_get(&gamma->refcount); in dc_gamma_retain() 186 struct dc_gamma *gamma = container_of(kref, struct dc_gamma, refcount); in dc_gamma_free() 192 kref_put(&(*gamma)->refcount, dc_gamma_free); in dc_gamma_release() 203 kref_init(&gamma->refcount); in dc_create_gamma() 212 kref_get(&tf->refcount); in dc_transfer_func_retain() 217 struct dc_transfer_func *tf = container_of(kref, struct dc_transfer_func, refcount); in dc_transfer_func_free() [all...] |
H A D | dc_sink.c | 62 kref_get(&sink->refcount); in dc_sink_retain() 67 struct dc_sink *sink = container_of(kref, struct dc_sink, refcount); in dc_sink_free() 74 kref_put(&sink->refcount, dc_sink_free); in dc_sink_release() 87 kref_init(&sink->refcount); in dc_sink_create()
|
/linux/net/dsa/ |
H A D | trace.h | 15 #include <linux/refcount.h> 58 * is first seen and its refcount is 1. 71 * when the refcount on shared ports reaches 0 86 const struct dsa_db *db, const refcount_t *refcount), 88 TP_ARGS(dp, addr, vid, db, refcount), 97 __field(unsigned int, refcount) 107 __entry->refcount = refcount_read(refcount); 110 TP_printk("%s %s port %d addr %pM vid %u db \"%s\" refcount %u", 112 __entry->vid, __entry->db_buf, __entry->refcount) [all...] |
/linux/include/trace/events/ |
H A D | objagg.h | 88 unsigned int refcount), 90 TP_ARGS(objagg, obj, refcount), 95 __field(unsigned int, refcount) 101 __entry->refcount = refcount; 104 TP_printk("objagg %p, obj %p, refcount %u", 105 __entry->objagg, __entry->obj, __entry->refcount) 111 unsigned int refcount), 113 TP_ARGS(objagg, obj, refcount), 118 __field(unsigned int, refcount) [all...] |
/linux/arch/arm64/kvm/hyp/include/nvhe/ |
H A D | memory.h | 51 u16 refcount; member 121 * hyp_pool::lock must be held if atomic access to the refcount is required. 127 return p->refcount; in hyp_page_count() 132 BUG_ON(p->refcount == USHRT_MAX); in hyp_page_ref_inc() 133 p->refcount++; in hyp_page_ref_inc() 138 BUG_ON(!p->refcount); in hyp_page_ref_dec() 139 p->refcount--; in hyp_page_ref_dec() 145 return (p->refcount == 0); in hyp_page_ref_dec_and_test() 150 BUG_ON(p->refcount); in hyp_set_page_refcounted() 151 p->refcount in hyp_set_page_refcounted() [all...] |
/linux/rust/kernel/block/mq/ |
H A D | request.rs | 25 /// 1. Request is owned by block layer (refcount 0). 27 /// (refcount 1). 29 /// (refcount 2). 31 /// (refcount > 2). 40 /// The states are tracked through the private `refcount` field of 51 /// `self.wrapper_ref().refcount()`. 63 /// * The caller must own a refcount on `ptr` that is transferred to the 84 /// `self.wrapper_ref().refcount() == 2`. 91 /// Try to take exclusive ownership of `this` by dropping the refcount to 0. 102 if let Err(_old) = this.wrapper_ref().refcount() in try_set_end() 176 refcount: AtomicU64, global() field 182 pub(crate) fn refcount(&self) -> &AtomicU64 { refcount() method 240 let refcount = &self.wrapper_ref().refcount(); inc_ref() localVariable 257 let refcount = unsafe { &*RequestDataWrapper::refcount_ptr(wrapper_ptr) }; dec_ref() localVariable [all...] |
/linux/kernel/bpf/ |
H A D | kmem_cache_iter.c | 59 /* boot_caches have negative refcount, don't touch them */ in bpf_iter_kmem_cache_next() 60 if (next && next->refcount > 0) in bpf_iter_kmem_cache_next() 61 next->refcount++; in bpf_iter_kmem_cache_next() 65 if (prev->refcount > 1) in bpf_iter_kmem_cache_next() 66 prev->refcount--; in bpf_iter_kmem_cache_next() 67 else if (prev->refcount == 1) in bpf_iter_kmem_cache_next() 92 if (s->refcount > 1) in bpf_iter_kmem_cache_destroy() 93 s->refcount--; in bpf_iter_kmem_cache_destroy() 94 else if (s->refcount == 1) in bpf_iter_kmem_cache_destroy() 134 * have a negative refcount, s in kmem_cache_iter_seq_start() [all...] |
/linux/drivers/scsi/qedf/ |
H A D | qedf_els.c | 84 kref_put(&els_req->refcount, qedf_release_cmd); in qedf_initiate_els() 97 kref_put(&els_req->refcount, qedf_release_cmd); in qedf_initiate_els() 188 kref_put(&els_req->refcount, qedf_release_cmd); in qedf_process_els_compl() 196 int refcount; in qedf_rrq_compl() local 211 refcount = kref_read(&orig_io_req->refcount); in qedf_rrq_compl() 213 " orig xid = 0x%x, rrq_xid = 0x%x, refcount=%d\n", in qedf_rrq_compl() 214 orig_io_req, orig_io_req->xid, rrq_req->xid, refcount); in qedf_rrq_compl() 221 if (orig_io_req && refcount > 0) in qedf_rrq_compl() 222 kref_put(&orig_io_req->refcount, qedf_release_cm in qedf_rrq_compl() 248 int refcount; qedf_send_rrq() local 549 int refcount; qedf_srr_compl() local 844 int refcount; qedf_rec_compl() local [all...] |
H A D | qedf_io.c | 54 kref_put(&io_req->refcount, qedf_release_cmd); in qedf_cmd_timeout() 75 kref_get(&io_req->refcount); in qedf_cmd_timeout() 90 kref_put(&io_req->refcount, qedf_release_cmd); in qedf_cmd_timeout() 375 kref_init(&io_req->refcount); /* ID: 001 */ in qedf_alloc_cmd() 383 kref_put(&io_req->refcount, qedf_release_cmd); in qedf_alloc_cmd() 435 container_of(ref, struct qedf_ioreq, refcount); in qedf_release_cmd() 828 io_log->refcount = kref_read(&io_req->refcount); in qedf_trace_io() 887 kref_put(&io_req->refcount, qedf_release_cmd); in qedf_post_io_req() 896 kref_put(&io_req->refcount, qedf_release_cm in qedf_post_io_req() 1127 int refcount; qedf_scsi_completion() local 1327 int refcount; qedf_scsi_done() local 1596 int refcount = 0; qedf_flush_active_ios() local 1862 int refcount = 0; qedf_initiate_abts() local 2159 int refcount = 0; qedf_initiate_cleanup() local [all...] |
/linux/drivers/infiniband/hw/hfi1/ |
H A D | mmu_rb.c | 22 static void release_immediate(struct kref *refcount); 111 kref_put(&rbnode->refcount, release_immediate); in hfi1_mmu_rb_unregister() 188 static void release_immediate(struct kref *refcount) in release_immediate() argument 191 container_of(refcount, struct mmu_rb_node, refcount); in release_immediate() 197 static void release_nolock(struct kref *refcount) in release_nolock() argument 200 container_of(refcount, struct mmu_rb_node, refcount); in release_nolock() 206 * struct mmu_rb_node->refcount kref_put() callback. 213 void hfi1_mmu_rb_release(struct kref *refcount) in hfi1_mmu_rb_release() argument [all...] |
/linux/Documentation/core-api/ |
H A D | kref.rst | 28 struct kref refcount; 46 kref_init(&data->refcount); 48 This sets the refcount in the kref to 1. 58 increment the refcount with kref_get() before passing it off:: 60 kref_get(&data->refcount); 63 refcount cannot go to zero) you may do this without a lock. 67 kref_put(&data->refcount, data_release); 85 struct my_data *data = container_of(ref, struct my_data, refcount); 95 kref_put(&data->refcount, data_release); 106 kref_init(&data->refcount); [all...] |
/linux/net/batman-adv/ |
H A D | originator.c | 73 if (!kref_get_unless_zero(&orig_node->refcount)) in batadv_orig_hash_find() 120 if (!kref_get_unless_zero(&tmp->refcount)) in batadv_orig_node_vlan_get() 187 kref_init(&vlan->refcount); in batadv_orig_node_vlan_new() 190 kref_get(&vlan->refcount); in batadv_orig_node_vlan_new() 208 orig_vlan = container_of(ref, struct batadv_orig_node_vlan, refcount); in batadv_orig_node_vlan_release() 252 neigh_ifinfo = container_of(ref, struct batadv_neigh_ifinfo, refcount); in batadv_neigh_ifinfo_release() 270 refcount); in batadv_hardif_neigh_release() 291 neigh_node = container_of(ref, struct batadv_neigh_node, refcount); in batadv_neigh_node_release() 331 if (router && !kref_get_unless_zero(&router->refcount)) in batadv_orig_router_get() 386 if (!kref_get_unless_zero(&tmp->refcount)) in batadv_orig_ifinfo_get() [all...] |
H A D | types.h | 192 /** @refcount: number of contexts the object is used */ 193 struct kref refcount; member 279 /** @refcount: number of contexts the object is used */ 280 struct kref refcount; member 348 * @refcount: number of context where this object is currently in use 350 struct kref refcount; member 502 /** @refcount: number of contexts the object is used */ 503 struct kref refcount; member 577 /** @refcount: number of contexts the object is used */ 578 struct kref refcount; member 634 struct kref refcount; global() member 669 struct kref refcount; global() member 738 struct kref refcount; global() member 1532 struct kref refcount; global() member 1560 struct kref refcount; global() member 1842 struct kref refcount; global() member 1874 struct kref refcount; global() member 1901 struct kref refcount; global() member 1961 struct kref refcount; global() member 1991 struct kref refcount; global() member 2030 struct kref refcount; global() member 2053 struct kref refcount; global() member 2315 struct kref refcount; global() member 2362 struct kref refcount; global() member 2404 struct kref refcount; global() member [all...] |
H A D | originator.h | 99 kref_put(&orig_vlan->refcount, batadv_orig_node_vlan_release); in batadv_orig_node_vlan_put() 113 kref_put(&neigh_ifinfo->refcount, batadv_neigh_ifinfo_release); in batadv_neigh_ifinfo_put() 127 kref_put(&hardif_neigh->refcount, batadv_hardif_neigh_release); in batadv_hardif_neigh_put() 140 kref_put(&neigh_node->refcount, batadv_neigh_node_release); in batadv_neigh_node_put() 154 kref_put(&orig_ifinfo->refcount, batadv_orig_ifinfo_release); in batadv_orig_ifinfo_put() 167 kref_put(&orig_node->refcount, batadv_orig_node_release); in batadv_orig_node_put()
|
/linux/drivers/gpu/drm/i915/display/ |
H A D | intel_dmc_wl.c | 159 WARN_ON(refcount_read(&wl->refcount)); in __intel_dmc_wl_release() 176 * Bail out if refcount became non-zero while waiting for the spinlock, in intel_dmc_wl_work() 179 if (refcount_read(&wl->refcount)) in intel_dmc_wl_work() 338 refcount_set(&wl->refcount, in intel_dmc_wl_init() 381 if (refcount_read(&wl->refcount)) in intel_dmc_wl_enable() 450 if (!refcount_inc_not_zero(&wl->refcount)) in intel_dmc_wl_get() 451 refcount_set(&wl->refcount, 1); in intel_dmc_wl_get() 457 if (refcount_inc_not_zero(&wl->refcount)) in intel_dmc_wl_get() 460 refcount_set(&wl->refcount, 1); in intel_dmc_wl_get() 482 if (WARN_RATELIMIT(!refcount_read(&wl->refcount), in intel_dmc_wl_put() [all...] |
/linux/drivers/media/mc/ |
H A D | mc-dev-allocator.c | 33 struct kref refcount; member 45 container_of(kref, struct media_device_instance, refcount); in media_device_instance_release() 71 kref_get(&mdi->refcount); in __media_device_get() 89 kref_init(&mdi->refcount); in __media_device_get() 133 kref_put(&mdi->refcount, media_device_instance_release); in media_device_delete()
|
/linux/drivers/net/ethernet/mellanox/mlx5/core/lib/ |
H A D | geneve.c | 14 u32 refcount; member 72 if (geneve->refcount) { in mlx5_geneve_tlv_option_add() 76 geneve->refcount++; in mlx5_geneve_tlv_option_add() 107 geneve->refcount++; in mlx5_geneve_tlv_option_add() 122 if (--geneve->refcount == 0) { in mlx5_geneve_tlv_option_del() 154 if (geneve->refcount) in mlx5_geneve_destroy()
|
/linux/drivers/accel/habanalabs/common/ |
H A D | context.c | 33 container_of(ref, struct hl_cs_encaps_sig_handle, refcount); in hl_encaps_release_handle_and_put_ctx() 41 container_of(ref, struct hl_cs_encaps_sig_handle, refcount); in hl_encaps_release_handle_and_put_sob() 49 container_of(ref, struct hl_cs_encaps_sig_handle, refcount); in hl_encaps_release_handle_and_put_sob_ctx() 75 kref_put(&handle->refcount, hl_encaps_release_handle_and_put_sob); in hl_encaps_sig_mgr_fini() 135 ctx = container_of(ref, struct hl_ctx, refcount); in hl_ctx_do_release() 206 kref_init(&ctx->refcount); in hl_ctx_init() 295 return kref_get_unless_zero(&ctx->refcount); in hl_ctx_get_unless_zero() 300 kref_get(&ctx->refcount); in hl_ctx_get() 305 return kref_put(&ctx->refcount, hl_ctx_do_release); in hl_ctx_put() 445 kref_put(&ctx->refcount, hl_ctx_do_releas in hl_ctx_mgr_fini() [all...] |
/linux/drivers/net/ethernet/mellanox/mlx5/core/ |
H A D | rl.c | 186 if (!table->rl_entry[i].refcount) in find_rl_entry() 191 if (table->rl_entry[i].refcount) { in find_rl_entry() 246 table->refcount++; in mlx5_rl_table_get() 261 table->refcount++; in mlx5_rl_table_get() 268 if (--table->refcount) in mlx5_rl_table_put() 284 if (table->rl_entry[i].refcount) in mlx5_rl_table_free() 291 entry->refcount++; in mlx5_rl_entry_get() 297 entry->refcount--; in mlx5_rl_entry_put() 298 if (!entry->refcount) in mlx5_rl_entry_put() 332 if (!entry->refcount) { in mlx5_rl_add_rate_raw() [all...] |
/linux/net/core/ |
H A D | dev_addr_lists.c | 65 ha->refcount = 1; in __hw_addr_create() 113 ha->refcount++; in __hw_addr_add_ex() 155 if (--ha->refcount) in __hw_addr_del_entry() 223 ha->refcount++; in __hw_addr_sync_one() 253 if (ha->sync_cnt == ha->refcount) { in __hw_addr_sync_multiple() 282 } else if (ha->refcount == 1) in __hw_addr_sync() 326 if (!ha->sync_cnt || ha->refcount != 1) in __hw_addr_sync_dev() 347 ha->refcount++; in __hw_addr_sync_dev() 383 if ((ha->sync_cnt << 1) <= ha->refcount) in __hw_addr_ref_sync_dev() 387 ref_cnt = ha->refcount in __hw_addr_ref_sync_dev() [all...] |
/linux/rust/kernel/sync/ |
H A D | arc.rs | 64 /// // Get a new pointer to `obj` and increment the refcount. 70 /// // Destroy `obj` and decrement its refcount. 77 /// // The refcount drops to zero when `cloned` goes out of scope, and the memory is freed. 148 refcount: Opaque<bindings::refcount_t>, field 230 // INVARIANT: The refcount is initialised to a non-zero value. in new() 233 refcount: Opaque::new(unsafe { bindings::REFCOUNT_INIT(1) }), in new() 263 /// The raw pointer has ownership of the refcount that this Arc object owned. 326 /// // The above conversion should succeed since refcount of `arc` is 1. 342 /// // The above conversion should fail since refcount of `arc` is >1. 348 // We will manually manage the refcount i in into_unique_or_drop() 351 let refcount = unsafe { me.ptr.as_ref() }.refcount.get(); into_unique_or_drop() localVariable 461 let refcount = unsafe { self.ptr.as_ref() }.refcount.get(); clone() localVariable 479 let refcount = unsafe { self.ptr.as_ref() }.refcount.get(); drop() localVariable [all...] |
/linux/include/net/ |
H A D | netrom.h | 15 #include <linux/refcount.h> 100 refcount_t refcount; member 116 refcount_t refcount; member 125 refcount_inc(&((__nr_node)->refcount)) 129 if (refcount_dec_and_test(&nr_node->refcount)) { in nr_node_put() 135 refcount_inc(&((__nr_neigh)->refcount)) 139 if (refcount_dec_and_test(&nr_neigh->refcount)) { in nr_neigh_put()
|
/linux/drivers/net/wireguard/ |
H A D | peer.c | 53 kref_init(&peer->refcount); in wg_peer_create() 75 if (unlikely(!peer || !kref_get_unless_zero(&peer->refcount))) in wg_peer_get_maybe_zero() 145 * with a refcount of zero, so no new reference is taken. in peer_remove_after_dead() 200 static void kref_release(struct kref *refcount) in kref_release() argument 202 struct wg_peer *peer = container_of(refcount, struct wg_peer, refcount); in kref_release() 227 kref_put(&peer->refcount, kref_release); in wg_peer_put()
|