now = jiffies; /* Check for a potential stall */ if (time_after_eq(now, dql->last_reap + stall_thrs)) { unsignedlong hist_head, t, start, end;
/* We are trying to detect a period of at least @stall_thrs *jiffieswithoutanyTxcompletions,butduringfirsthalf *ofwhichsomeTxwasposted.
*/
dqs_again:
hist_head = READ_ONCE(dql->history_head); /* pairs with smp_wmb() in dql_queued() */
smp_rmb();
/* Get the previous entry in the ring buffer, which is the *oldestsample.
*/
start = (hist_head - DQL_HIST_LEN + 1) * BITS_PER_LONG;
/* Advance start to continue from the last reap time */ if (time_before(start, dql->last_reap + 1))
start = dql->last_reap + 1;
/* Newest sample we should have already seen a completion for */
end = hist_head * BITS_PER_LONG + (BITS_PER_LONG - 1);
/* Shrink the search space to [start, (now - start_thrs/2)] if *`end`isbeyondthestallzone
*/ if (time_before(now, end + stall_thrs / 2))
end = now - stall_thrs / 2;
/* Search for the queued time in [t, end] */ for (t = start; time_before_eq(t, end); t++) if (test_bit(t % (DQL_HIST_LEN * BITS_PER_LONG),
dql->history)) break;
/* Variable t contains the time of the queue */ if (!time_before_eq(t, end)) goto no_stall;
/* The ring buffer was modified in the meantime, retry */ if (hist_head != READ_ONCE(dql->history_head)) goto dqs_again;
dql->stall_cnt++;
dql->stall_max = max_t(unsignedshort, dql->stall_max, now - t);
/* Records completed count and recalculates the queue limit */ void dql_completed(struct dql *dql, unsignedint count)
{ unsignedint inprogress, prev_inprogress, limit; unsignedint ovlimit, completed, num_queued; unsignedshort stall_thrs; bool all_prev_completed;
num_queued = READ_ONCE(dql->num_queued); /* Read stall_thrs in advance since it belongs to the same (first) *cachelineas->num_queued.Thisway,dql_check_stall()doesnot *needtotouchthefirstcachelineagainlater,reducingthewindow *ofpossiblefalsesharing.
*/
stall_thrs = READ_ONCE(dql->stall_thrs);
/* Can't complete more than what's in queue */
BUG_ON(count > num_queued - dql->num_completed);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.