Skip to content

Commit

Permalink
Merge remote-tracking branch 'ivancich/wip-bring-in-dmclock-p2' into …
Browse files Browse the repository at this point in the history
…wip-12-0-3-alt
  • Loading branch information
smithfarm committed May 22, 2017
2 parents aed3cbf + 8215686 commit 03ad4fe
Show file tree
Hide file tree
Showing 32 changed files with 1,992 additions and 453 deletions.
2 changes: 0 additions & 2 deletions ceph.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -1680,8 +1680,6 @@ ln -sf %{_libdir}/librbd.so.1 /usr/lib64/qemu/librbd.so.1
%{_bindir}/ceph-osdomap-tool
%{_bindir}/ceph-kvstore-tool
%{_bindir}/ceph-debugpack
%{_bindir}/dmclock-tests
%{_bindir}/dmclock-data-struct-tests
%{_mandir}/man8/ceph-debugpack.8*
%dir %{_libdir}/ceph
%{_libdir}/ceph/ceph-monstore-update-crush.sh
Expand Down
2 changes: 0 additions & 2 deletions debian/ceph-test.install
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@ usr/bin/ceph_xattr_bench
usr/bin/ceph-monstore-tool
usr/bin/ceph-osdomap-tool
usr/bin/ceph-kvstore-tool
usr/bin/dmclock-tests
usr/bin/dmclock-data-struct-tests
usr/share/java/libcephfs-test.jar
usr/lib/ceph/ceph-monstore-update-crush.sh
14 changes: 6 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -879,16 +879,14 @@ add_subdirectory(compressor)

add_subdirectory(tools)

# dmClock

add_subdirectory(dmclock) # after gmock
add_dependencies(tests dmclock-tests dmclock-data-struct-tests)
# dmClock (after gmock)

add_subdirectory(dmclock/src)
if(WITH_TESTS)
install(PROGRAMS
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/dmclock-tests
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/dmclock-data-struct-tests
DESTINATION bin)
# note: add_test is not being called, so dmclock tests aren't part
# of ceph tests
add_subdirectory(dmclock/test)
add_subdirectory(dmclock/support/test)
endif(WITH_TESTS)

if(HAVE_INTEL)
Expand Down
9 changes: 5 additions & 4 deletions src/common/OpQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ class OpQueue {
public:
// How many Ops are in the queue
virtual unsigned length() const = 0;
// Ops will be removed f evaluates to true, f may have sideeffects
virtual void remove_by_filter(
std::function<bool (T)> f) = 0;
// Ops of this priority should be deleted immediately
// Ops of this class should be deleted immediately. If out isn't
// nullptr then items should be added to the front in
// front-to-back order. The typical strategy is to visit items in
// the queue in *reverse* order and to use *push_front* to insert
// them into out.
virtual void remove_by_class(K k, std::list<T> *out) = 0;
// Enqueue op in the back of the strict queue
virtual void enqueue_strict(K cl, unsigned priority, T item) = 0;
Expand Down
63 changes: 0 additions & 63 deletions src/common/PrioritizedQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,6 @@ class PrioritizedQueue : public OpQueue <T, K> {
int64_t min_cost;

typedef std::list<std::pair<unsigned, T> > ListPairs;
static unsigned filter_list_pairs(
ListPairs *l,
std::function<bool (T)> f) {
unsigned ret = 0;
for (typename ListPairs::iterator i = l->end();
i != l->begin();
) {
auto next = i;
--next;
if (f(next->second)) {
++ret;
l->erase(next);
} else {
i = next;
}
}
return ret;
}

struct SubQueue {
private:
Expand Down Expand Up @@ -145,24 +127,6 @@ class PrioritizedQueue : public OpQueue <T, K> {
bool empty() const {
return q.empty();
}
void remove_by_filter(
std::function<bool (T)> f) {
for (typename Classes::iterator i = q.begin();
i != q.end();
) {
size -= filter_list_pairs(&(i->second), f);
if (i->second.empty()) {
if (cur == i) {
++cur;
}
q.erase(i++);
} else {
++i;
}
}
if (cur == q.end())
cur = q.begin();
}
void remove_by_class(K k, std::list<T> *out) {
typename Classes::iterator i = q.find(k);
if (i == q.end()) {
Expand Down Expand Up @@ -254,33 +218,6 @@ class PrioritizedQueue : public OpQueue <T, K> {
return total;
}

void remove_by_filter(
std::function<bool (T)> f) final {
for (typename SubQueues::iterator i = queue.begin();
i != queue.end();
) {
unsigned priority = i->first;

i->second.remove_by_filter(f);
if (i->second.empty()) {
++i;
remove_queue(priority);
} else {
++i;
}
}
for (typename SubQueues::iterator i = high_queue.begin();
i != high_queue.end();
) {
i->second.remove_by_filter(f);
if (i->second.empty()) {
high_queue.erase(i++);
} else {
++i;
}
}
}

void remove_by_class(K k, std::list<T> *out = 0) final {
for (typename SubQueues::iterator i = queue.begin();
i != queue.end();
Expand Down
50 changes: 0 additions & 50 deletions src/common/WeightedPriorityQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,6 @@ class WeightedPriorityQueue : public OpQueue <T, K>
unsigned get_size() const {
return lp.size();
}
unsigned filter_list_pairs(std::function<bool (T)>& f) {
unsigned count = 0;
// intrusive containers can't erase with a reverse_iterator
// so we have to walk backwards on our own. Since there is
// no iterator before begin, we have to test at the end.
for (Lit i = --lp.end();; --i) {
if (f(i->item)) {
i = lp.erase_and_dispose(i, DelItem<ListPair>());
++count;
}
if (i == lp.begin()) {
break;
}
}
return count;
}
unsigned filter_class(std::list<T>* out) {
unsigned count = 0;
for (Lit i = --lp.end();; --i) {
Expand Down Expand Up @@ -180,25 +164,6 @@ class WeightedPriorityQueue : public OpQueue <T, K>
check_end();
return ret;
}
unsigned filter_list_pairs(std::function<bool (T)>& f) {
unsigned count = 0;
// intrusive containers can't erase with a reverse_iterator
// so we have to walk backwards on our own. Since there is
// no iterator before begin, we have to test at the end.
for (Kit i = klasses.begin(); i != klasses.end();) {
count += i->filter_list_pairs(f);
if (i->empty()) {
if (next == i) {
++next;
}
i = klasses.erase_and_dispose(i, DelItem<Klass>());
} else {
++i;
}
}
check_end();
return count;
}
unsigned filter_class(K& cl, std::list<T>* out) {
unsigned count = 0;
Kit i = klasses.find(cl, MapKey<Klass, K>());
Expand Down Expand Up @@ -291,17 +256,6 @@ class WeightedPriorityQueue : public OpQueue <T, K>
}
return ret;
}
void filter_list_pairs(std::function<bool (T)>& f) {
for (Sit i = queues.begin(); i != queues.end();) {
size -= i->filter_list_pairs(f);
if (i->empty()) {
total_prio -= i->key;
i = queues.erase_and_dispose(i, DelItem<SubQueue>());
} else {
++i;
}
}
}
void filter_class(K& cl, std::list<T>* out) {
for (Sit i = queues.begin(); i != queues.end();) {
size -= i->filter_class(cl, out);
Expand Down Expand Up @@ -338,10 +292,6 @@ class WeightedPriorityQueue : public OpQueue <T, K>
unsigned length() const final {
return strict.size + normal.size;
}
void remove_by_filter(std::function<bool (T)> f) final {
strict.filter_list_pairs(f);
normal.filter_list_pairs(f);
}
void remove_by_class(K cl, std::list<T>* removed = 0) final {
strict.filter_class(cl, removed);
normal.filter_class(cl, removed);
Expand Down
26 changes: 25 additions & 1 deletion src/common/config_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -756,9 +756,33 @@ OPTION(osd_disk_thread_ioprio_priority, OPT_INT, -1) // 0-7
OPTION(osd_recover_clone_overlap, OPT_BOOL, true) // preserve clone_overlap during recovery/migration
OPTION(osd_op_num_threads_per_shard, OPT_INT, 2)
OPTION(osd_op_num_shards, OPT_INT, 5)
OPTION(osd_op_queue, OPT_STR, "wpq") // PrioritzedQueue (prio), Weighted Priority Queue (wpq), or debug_random

// PrioritzedQueue (prio), Weighted Priority Queue (wpq ; default),
// mclock_opclass, mclock_client, or debug_random. mclock_opclass and
// mclock_client are based on the mClock/dmClock algorithm (Gulati,
// Merchant, and Varman 2010). mclock_opclass prioritizes based on the
// class the operation belongs to. mclock_client does the same but
// also works to ienforce fairness between clients.
OPTION(osd_op_queue, OPT_STR, "wpq")
OPTION(osd_op_queue_cut_off, OPT_STR, "low") // Min priority to go to strict queue. (low, high, debug_random)

// mClock priority queue parameters for five types of ops
OPTION(osd_op_queue_mclock_client_op_res, OPT_DOUBLE, 1000.0)
OPTION(osd_op_queue_mclock_client_op_wgt, OPT_DOUBLE, 500.0)
OPTION(osd_op_queue_mclock_client_op_lim, OPT_DOUBLE, 0.0)
OPTION(osd_op_queue_mclock_osd_subop_res, OPT_DOUBLE, 1000.0)
OPTION(osd_op_queue_mclock_osd_subop_wgt, OPT_DOUBLE, 500.0)
OPTION(osd_op_queue_mclock_osd_subop_lim, OPT_DOUBLE, 0.0)
OPTION(osd_op_queue_mclock_snap_res, OPT_DOUBLE, 0.0)
OPTION(osd_op_queue_mclock_snap_wgt, OPT_DOUBLE, 1.0)
OPTION(osd_op_queue_mclock_snap_lim, OPT_DOUBLE, 0.001)
OPTION(osd_op_queue_mclock_recov_res, OPT_DOUBLE, 0.0)
OPTION(osd_op_queue_mclock_recov_wgt, OPT_DOUBLE, 1.0)
OPTION(osd_op_queue_mclock_recov_lim, OPT_DOUBLE, 0.001)
OPTION(osd_op_queue_mclock_scrub_res, OPT_DOUBLE, 0.0)
OPTION(osd_op_queue_mclock_scrub_wgt, OPT_DOUBLE, 1.0)
OPTION(osd_op_queue_mclock_scrub_lim, OPT_DOUBLE, 0.001)

OPTION(osd_ignore_stale_divergent_priors, OPT_BOOL, false) // do not assert on divergent_prior entries which aren't in the log and whose on-disk objects are newer

// Set to true for testing. Users should NOT set this.
Expand Down

0 comments on commit 03ad4fe

Please sign in to comment.