I understand that atomic_dec_and_test returns 1 when the result of the
operation is 0, and 0 otherwise.
I've seen two ways of handling the resulting operation, below are a couple
of examples:
(1) if (!atomic_dec_and_test(&rd->refcount))
          return;
     call_rcu(&rd->rcu, free_rootdomain);

(2)  if (atomic64_dec_and_test(&map->refcnt)) {
          /* bpf_map_free_id() must be called first */
          ...
       }

Is it prefered to use one option over the other? Or is it just personal
preference?

Thanks in advance!
Camila Alvarez

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to