| /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...] |
| H A D | switch.c | 179 refcount_inc(&a->refcount); in dsa_port_do_mdb_add() 181 &a->refcount); in dsa_port_do_mdb_add() 201 refcount_set(&a->refcount, 1); in dsa_port_do_mdb_add() 236 if (!refcount_dec_and_test(&a->refcount)) { in dsa_port_do_mdb_del() 238 &a->refcount); in dsa_port_do_mdb_del() 245 refcount_set(&a->refcount, 1); in dsa_port_do_mdb_del() 278 refcount_inc(&a->refcount); in dsa_port_do_fdb_add() 279 trace_dsa_fdb_add_bump(dp, addr, vid, &db, &a->refcount); in dsa_port_do_fdb_add() 299 refcount_set(&a->refcount, 1); in dsa_port_do_fdb_add() 333 if (!refcount_dec_and_test(&a->refcount)) { in dsa_port_do_fdb_del() [all …]
|
| /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_release); [all …]
|
| /linux/rust/kernel/sync/ |
| H A D | refcount.rs | 5 //! C header: [`include/linux/refcount.h`](srctree/include/linux/refcount.h) 16 /// [`include/linux/refcount.h`](srctree/include/linux/refcount.h). 20 pub struct Refcount(Opaque<bindings::refcount_t>); struct 22 impl Refcount { implementation 23 /// Construct a new [`Refcount`] from an initial value. 39 /// Get the underlying atomic counter that backs the refcount. 42 /// `refcount.h`. If there is no way to achieve the result using APIs in `refcount.h`, then 53 /// Set a refcount's value. 60 /// Increment a refcount. 62 /// It will saturate if overflows and `WARN`. It will also `WARN` if the refcount is 0, as this [all …]
|
| /linux/lib/ |
| H A D | refcount.c | 3 * Out-of-line refcount functions. 7 #include <linux/refcount.h> 40 * refcount_dec_if_one - decrement a refcount if it is 1 41 * @r: the refcount 53 * Return: true if the resulting refcount is 0, false otherwise 64 * refcount_dec_not_one - decrement a refcount if it is not 1 65 * @r: the refcount 99 * refcount to 0 100 * @r: the refcount 110 * Return: true and hold mutex if able to decrement refcount to 0, false [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) 124 __entry->refcount = refcount; [all …]
|
| /linux/fs/xfs/scrub/ |
| H A D | refcount.c | 50 * We want to count the reverse mappings overlapping a refcount record 51 * (bno, len, refcount), allowing for the possibility that some of the 56 * 1. For all reverse mappings overlapping the refcount extent, 62 * refcount record we want to find $refcount owners and we've already 64 * need to find ($refcount - $seen) owners for every block in the 78 * and that they all end at or beyond the end of the refcount extent. 80 * If the refcount is correct, all the check conditions in the algorithm 81 * should always hold true. If not, the refcount is incorrect. 92 /* refcount extent we're examining */ 95 xfs_nlink_t refcount; member [all …]
|
| H A D | rtrefcount.c | 28 /* Set us up with the realtime refcount metadata locked. */ 64 * We want to count the reverse mappings overlapping a refcount record 65 * (bno, len, refcount), allowing for the possibility that some of the 70 * 1. For all reverse mappings overlapping the refcount extent, 76 * refcount record we want to find $refcount owners and we've already 78 * need to find ($refcount - $seen) owners for every block in the 92 * and that they all end at or beyond the end of the refcount extent. 94 * If the refcount is correct, all the check conditions in the algorithm 95 * should always hold true. If not, the refcount is incorrect. 106 /* refcount extent we're examining */ [all …]
|
| H A D | rtrefcount_repair.c | 68 * Note that in the actual refcnt btree we don't store the refcount < 2 80 * rt refcount btree as follows: 93 * - If the bag size isn't old_bag_size, store the refcount entry 102 * Like all the other repairers, we make a list of all the refcount 103 * records we need, then reinitialize the rt refcount btree root and 108 /* refcount extents */ 119 /* get_records()'s position in the rt refcount record array. */ 126 /* Set us up to repair refcount btrees. */ 164 uint64_t refcount) in xrep_rtrefc_stash() argument 169 .rc_refcount = refcount, in xrep_rtrefc_stash() [all …]
|
| H A D | refcount_repair.c | 63 * Note that in the actual refcnt btree we don't store the refcount < 2 75 * refcount btree as follows: 88 * - If the bag size isn't old_bag_size, store the refcount entry 97 * Like all the other repairers, we make a list of all the refcount 98 * records we need, then reinitialize the refcount btree root and 103 /* refcount extents */ 114 /* get_records()'s position in the refcount record array. */ 121 /* Set us up to repair refcount btrees. */ 167 uint64_t refcount) in xrep_refc_stash() argument 180 irec.rc_refcount = min_t(uint64_t, XFS_REFC_REFCOUNT_MAX, refcount); in xrep_refc_stash() [all …]
|
| /linux/include/linux/ |
| H A D | percpu-refcount.h | 7 * This implements a refcount with similar semantics to atomic_t - atomic_inc(), 11 * refcounts; you have to keep track of your initial refcount, and then when you 13 * refcount. 15 * The refcount will have a range of 0 to ((1U << 31) - 1), i.e. one bit less 20 * refcount hitting 0 - it can't, if it was in percpu mode. percpu_ref_kill() 43 * explicit synchronization to ensure the initial refcount can only be dropped 139 * Must be used to drop the initial ref on a percpu refcount; must be called 153 * Internal helper. Don't use outside percpu-refcount proper. The 190 * percpu_ref_get_many - increment a percpu refcount 213 * percpu_ref_get - increment a percpu refcount [all …]
|
| H A D | closure.h | 17 * They embed a refcount. The basic idea is they count "things that are in 21 * The refcount may be manipulated with closure_get() and closure_put(). 23 * the refcount to go to 0. 28 * refcount hits 1. 40 * To use safely closures asynchronously, they must always have a refcount while 63 * If closure's refcount started at 0, complete_some_read() could run before the 69 * So, closure_init() initializes a closure's refcount to 1 - and when a 70 * closure_fn is run, the refcount will be reset to 1 first. 72 * Then, the rule is - if you got the refcount with closure_get(), release it 73 * with closure_put() (i.e, in a bio->bi_endio function). If you have a refcount [all …]
|
| H A D | shrinker.h | 7 #include <linux/refcount.h> 94 * initial refcount of 1, then the lookup operations are now allowed 96 * the initial refcount will be discarded, and will free the shrinker 97 * asynchronously via RCU after its refcount reaches 0. 99 refcount_t refcount; member 100 struct completion done; /* use to wait for refcount to reach 0 */ 141 return refcount_inc_not_zero(&shrinker->refcount); in shrinker_try_get() 146 if (refcount_dec_and_test(&shrinker->refcount)) in shrinker_put()
|
| /linux/tools/testing/selftests/bpf/prog_tests/ |
| H A D | map_kptr.c | 26 ASSERT_OK(ret, "test_map_kptr_ref1 refcount"); in test_map_kptr_success() 29 ASSERT_OK(ret, "test_map_kptr_ref2 refcount"); in test_map_kptr_success() 33 ASSERT_OK(ret, "test_ls_map_kptr_ref1 refcount"); in test_map_kptr_success() 37 ASSERT_OK(ret, "test_ls_map_kptr_ref2 refcount"); in test_map_kptr_success() 56 ASSERT_OK(ret, "test_map_kptr_ref3 refcount"); in test_map_kptr_success() 64 ASSERT_OK(ret, "test_map_kptr_ref3 refcount"); in test_map_kptr_success() 71 ASSERT_OK(ret, "test_map_kptr_ref3 refcount"); in test_map_kptr_success() 78 ASSERT_OK(ret, "test_map_kptr_ref3 refcount"); in test_map_kptr_success() 85 ASSERT_OK(ret, "test_map_kptr_ref3 refcount"); in test_map_kptr_success() 92 ASSERT_OK(ret, "test_map_kptr_ref3 refcount"); in test_map_kptr_success() [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_cmd); in qedf_rrq_compl() 232 kref_put(&rrq_req->refcount, qedf_release_cmd); in qedf_rrq_compl() [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 216 container_of(refcount, struct mmu_rb_node, refcount); in hfi1_mmu_rb_release() 240 /* refcount == 1 implies mmu_rb_handler has only rbnode ref */ in hfi1_mmu_rb_evict() [all …]
|
| H A D | trace_mmu.h | 22 __field(unsigned int, refcount) 26 __entry->refcount = kref_read(&node->refcount); 28 TP_printk("MMU node addr 0x%lx, len %lu, refcount %u", 31 __entry->refcount
|
| /linux/drivers/media/common/videobuf2/ |
| H A D | videobuf2-memops.c | 84 * vb2_common_vm_open() - increase refcount of the vma 94 pr_debug("%s: %p, refcount: %d, vma: %08lx-%08lx\n", in vb2_common_vm_open() 95 __func__, h, refcount_read(h->refcount), vma->vm_start, in vb2_common_vm_open() 98 refcount_inc(h->refcount); in vb2_common_vm_open() 102 * vb2_common_vm_close() - decrease refcount of the vma 112 pr_debug("%s: %p, refcount: %d, vma: %08lx-%08lx\n", in vb2_common_vm_close() 113 __func__, h, refcount_read(h->refcount), vma->vm_start, in vb2_common_vm_close() 120 * vb2_common_vm_ops - common vm_ops used for tracking refcount of mmapped
|
| /linux/security/apparmor/include/ |
| H A D | policy.h | 102 * @count: refcount for the pdb 130 * aa_get_pdb - increment refcount on @pdb 134 * Requires: @pdb must be held with valid refcount when called 145 * aa_put_pdb - put a pdb refcount 146 * @pdb: pdb to put refcount (MAYBE NULL) 148 * Requires: if @pdb != NULL that a valid refcount be held 223 * @base - base components of the profile (name, refcount, lists, lock ...) 319 * Returns refcount to newest version of the profile (maybe @p) 321 * Requires: @p must be held with a valid refcount 373 * aa_get_profile - increment refcount on profile @p [all …]
|
| /linux/include/media/ |
| H A D | videobuf2-memops.h | 19 #include <linux/refcount.h> 22 * struct vb2_vmarea_handler - common vma refcount tracking handler. 24 * @refcount: pointer to &refcount_t entry in the buffer. 25 * @put: callback to function that decreases buffer refcount. 29 refcount_t *refcount; member
|
| H A D | cec-notifier.h | 31 * increase the refcount and return that notifier. 43 * cec_notifier_conn_unregister - decrease refcount and delete when the 44 * refcount reaches 0. 58 * increase the refcount and return that notifier. 70 * cec_notifier_cec_adap_unregister - decrease refcount and delete when the 71 * refcount reaches 0. 104 * Note that the refcount of the returned device is not incremented.
|
| /linux/drivers/misc/lkdtm/ |
| H A D | refcount.c | 3 * This is for all the tests related to refcount bugs (e.g. overflow, 7 #include <linux/refcount.h> 19 pr_err("Fail: refcount wrapped to %d\n", refcount_read(ref)); in overflow_check() 24 * A refcount_inc() above the maximum value of the refcount implementation, 97 pr_err("Fail: refcount went crazy: %d\n", refcount_read(ref)); in check_zero() 122 * refcount_t refuses to move a refcount at all on an in check_negative() 140 pr_err("Fail: refcount went crazy: %d\n", refcount_read(ref)); in check_negative() 231 pr_err("Fail: refcount went past zero!\n"); in lkdtm_REFCOUNT_INC_ZERO() 256 pr_err("Fail: refcount went past zero\n"); in lkdtm_REFCOUNT_ADD_ZERO() 277 pr_err("Fail: refcount went crazy: %d\n", refcount_read(ref)); in check_saturated() [all …]
|
| /linux/rust/kernel/fs/ |
| H A D | file.rs | 128 /// Whenever a process has an fd to a file, it may use something called a "light refcount" as a 131 /// `fdget` and `fdput`, then the refcount cannot hit zero during that time, as the `struct 133 /// file even if `fdget` does not increment the refcount. 135 /// The requirement that the fd is not closed during a light refcount applies globally across all 136 /// threads - not just on the thread using the light refcount. For this reason, light refcounts are 139 /// calling `fdget` on a shared `struct files_struct` creates a normal refcount instead of a light 140 /// refcount. 153 /// `fdget`. With `fdget`, you may avoid incrementing the refcount as long as the current fd table 199 // makes `ARef<File>` own a normal refcount. 203 // SAFETY: The existence of a shared reference means that the refcount is nonzero. in inc_ref() [all …]
|
| /linux/net/batman-adv/ |
| H A D | originator.c | 72 if (!kref_get_unless_zero(&orig_node->refcount)) in batadv_orig_hash_find() 119 if (!kref_get_unless_zero(&tmp->refcount)) in batadv_orig_node_vlan_get() 186 kref_init(&vlan->refcount); in batadv_orig_node_vlan_new() 189 kref_get(&vlan->refcount); in batadv_orig_node_vlan_new() 207 orig_vlan = container_of(ref, struct batadv_orig_node_vlan, refcount); in batadv_orig_node_vlan_release() 251 neigh_ifinfo = container_of(ref, struct batadv_neigh_ifinfo, refcount); in batadv_neigh_ifinfo_release() 269 refcount); in batadv_hardif_neigh_release() 290 neigh_node = container_of(ref, struct batadv_neigh_node, refcount); in batadv_neigh_node_release() 330 if (router && !kref_get_unless_zero(&router->refcount)) in batadv_orig_router_get() 385 if (!kref_get_unless_zero(&tmp->refcount)) in batadv_orig_ifinfo_get() [all …]
|
| /linux/fs/xfs/libxfs/ |
| H A D | xfs_refcount.c | 34 /* Allowable refcount adjustment amounts. */ 128 /* Simple checks for refcount records. */ 191 "RT Refcount BTree record corruption in rtgroup %u detected at %pS!", in xfs_refcount_complain_bad_rec() 195 "Refcount BTree record corruption in AG %d detected at %pS!", in xfs_refcount_complain_bad_rec() 233 * by [bno, len, refcount]. 261 * by [bno, len, refcount]. 350 * refcount extents crossing either boundary of the range to be 352 * two extents so that we can increment the refcount of one of the 363 * refcount tree within the adjustment range represents a physical 364 * extent with refcount == 1: [all …]
|