Suggestion to Improve performance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

   I was checking code of internal data structures (dict,fd,rpc_clnt etc.) those we use in glusterfs to store data.
   Usually we use common pattern to take reference of data structure in xlator level, in ref function we do take lock(mutex_lock) 
   and update(increase) reference counter and in unref function we do take lock and decrease reference counter and 
   check if ref counter is become 0 after decrease then destroy object.

   I think to update reference counter we don't need to take a lock, we can use atomic in-built function those 
   can improve performance 

   For ex: Below is a example for specific to dict_ref/unref  
   To increase refCount we can use below built-in function
   dict_ref
   {
       __atomic_add_fetch (&this->refcount, 1, __ATOMIC_SEQ_CST);

   }

   dict_unref
   {
      __atomic_sub_fetch (&this->refcount, 1, __ATOMIC_SEQ_CST);
      __atomic_load (&this->refcount, &ref, __ATOMIC_SEQ_CST);
   }
     
   In the same way we can use for all other shared data-structure also in case of take/release reference.

   I have not tested yet how much performance improvement we can gain but i think there should be some improvement. 
  Please share your input on this, appreciate your input.

Regards
Mohit Agrawal
_______________________________________________
Gluster-devel mailing list
Gluster-devel@xxxxxxxxxxx
http://lists.gluster.org/mailman/listinfo/gluster-devel

[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux