mempool tracking

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

 



Hi Allen,

I was thinking a bit about the mempool tracking implementation and 
if there was a reason we couldn't do something simpler with thread local 
variables.  Maybe this came up before, but I'm not remembering.  I'm 
thinking something like

struct per_thread_stats {
  int64_t num_objects, num_bytes;
  ...
  per_thread_stats *next;
};

thread_local struct per_thread_stats g_per_thread = nullptr;
struct per_thread_stats *g_all_threads = nullptr;
ceph_spinlock_t g_thread_list_spinlock;

- The alloc/dealloc calls can just update the g_per_thread struct directly 
(don't even need to use atomics, probably?).

- The method to read stats can walk the g_all_threads linked list - on 
thread create/exit we allocate the thread local struct and add it to the 
list.

- spinlock would protect linked list updates.

The main downside I see to this approach is that we kind of need to keep 
using the common/Thread wrapper to ensure the init/teardown happens.  
Anyone using std::thread would need to do it explicitly.

(Or, the mempool stuff could have a check for a null value and, if so, 
allocate it dynamically. That would leave orphan items around for threads 
that got destroyed, though.)

Anyway, this seems simpler to the hashing we do now.  It would also 
degenerate to a simple non-atomic inc/dec for the seastar threads, which 
would be nice.

Am I missing something?

sage
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux