Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Modify reducing reservation function to reflect rho effect in weight-based phase. #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Modify reducing reservation function to reflect rho effect
in weight-based phase.

Signed-off-by: bspark <[email protected]>
  • Loading branch information
bspark8 committed Feb 21, 2017
commit d3663921feb8983f4b1149900db8cdfd98652b82
45 changes: 37 additions & 8 deletions src/dmclock_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ namespace crimson {
double proportion;
double limit;
bool ready; // true when within limit
uint32_t delta;
uint32_t rho;
#ifndef DO_NOT_DELAY_TAG_CALC
Time arrival;
#endif
Expand All @@ -135,19 +137,28 @@ namespace crimson {
client.limit_inv,
req_params.delta,
false)),
ready(false)
ready(false),
delta(req_params.delta),
rho(req_params.rho)
#ifndef DO_NOT_DELAY_TAG_CALC
, arrival(time)
#endif
{
assert(reservation < max_tag || proportion < max_tag);
}

RequestTag(double _res, double _prop, double _lim, const Time& _arrival) :
RequestTag(double _res,
double _prop,
double _lim,
uint32_t _delta,
uint32_t _rho,
const Time& _arrival) :
reservation(_res),
proportion(_prop),
limit(_lim),
ready(false)
ready(false),
delta(_delta),
rho(_rho)
#ifndef DO_NOT_DELAY_TAG_CALC
, arrival(_arrival)
#endif
Expand All @@ -159,7 +170,9 @@ namespace crimson {
reservation(other.reservation),
proportion(other.proportion),
limit(other.limit),
ready(other.ready)
ready(other.ready),
delta(other.delta),
rho(other.rho)
#ifndef DO_NOT_DELAY_TAG_CALC
, arrival(other.arrival)
#endif
Expand Down Expand Up @@ -211,6 +224,8 @@ namespace crimson {
" r:" << format_tag(tag.reservation) <<
" p:" << format_tag(tag.proportion) <<
" l:" << format_tag(tag.limit) <<
" delta:" << tag.delta <<
" rho:" << tag.rho <<
#if 0 // try to resolve this to make sure Time is operator<<'able.
#ifndef DO_NOT_DELAY_TAG_CALC
" arrival:" << tag.arrival <<
Expand Down Expand Up @@ -277,6 +292,7 @@ namespace crimson {
C client;
RequestTag prev_tag;
std::deque<ClientReq> requests;
uint32_t popped_req_rho;

// amount added from the proportion tag as a result of
// an idle client becoming unidle
Expand All @@ -301,7 +317,8 @@ namespace crimson {
const ClientInfo& _info,
Counter current_tick) :
client(_client),
prev_tag(0.0, 0.0, 0.0, TimeZero),
prev_tag(0.0, 0.0, 0.0, 1, 1, TimeZero),
popped_req_rho(1),
info(_info),
idle(true),
last_tick(current_tick),
Expand Down Expand Up @@ -329,6 +346,14 @@ namespace crimson {
last_tick = _tick;
}

inline uint32_t get_popped_req_rho() const {
return popped_req_rho;
}

inline void set_popped_req_rho(uint32_t rho) {
popped_req_rho = rho;
}

inline void add_request(const RequestTag& tag,
const C& client_id,
RequestRef&& request) {
Expand Down Expand Up @@ -818,7 +843,7 @@ namespace crimson {
} // if this client was idle

#ifndef DO_NOT_DELAY_TAG_CALC
RequestTag tag(0, 0, 0, time);
RequestTag tag(0, 0, 0, 1, 1, time);

if (!client.has_request()) {
tag = RequestTag(client.get_req_tag(), client.info,
Expand Down Expand Up @@ -872,6 +897,10 @@ namespace crimson {
// pop request and adjust heaps
top.pop_request();

// store popped request's rho to handle reducing reservation
// tags process when weight-based scheduling case
top.set_popped_req_rho(first.tag.rho);

#ifndef DO_NOT_DELAY_TAG_CALC
if (top.has_request()) {
ClientReq& next_first = top.next_request();
Expand Down Expand Up @@ -899,15 +928,15 @@ namespace crimson {
// data_mtx should be held when called
void reduce_reservation_tags(ClientRec& client) {
for (auto& r : client.requests) {
r.tag.reservation -= client.info.reservation_inv;
r.tag.reservation -= (client.get_popped_req_rho() * client.info.reservation_inv);

#ifndef DO_NOT_DELAY_TAG_CALC
// reduce only for front tag. because next tags' value are invalid
break;
#endif
}
// don't forget to update previous tag
client.prev_tag.reservation -= client.info.reservation_inv;
client.prev_tag.reservation -= (client.get_popped_req_rho() * client.info.reservation_inv);
resv_heap.promote(client);
}

Expand Down