Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d2d825e authored by Tatyana Brokhman's avatar Tatyana Brokhman Committed by Stephen Boyd
Browse files

block: row: Aggregate row_queue parameters to one structure



Each ROW queues has several parameters which default values are defined
in separate arrays. This patch aggregates all default values into one
array.
The values in question are:
 - is idling enabled for the queue
 - queue quantum
 - can the queue notify on urgent request

Change-Id: I3821b0a042542295069b340406a16b1000873ec6
Signed-off-by: default avatarTatyana Brokhman <tlinder@codeaurora.org>
parent 4e832c28
Loading
Loading
Loading
Loading
+35 −34
Original line number Diff line number Diff line
@@ -47,37 +47,38 @@ enum row_queue_prio {
	ROWQ_MAX_PRIO,
};

/* Flags indicating whether idling is enabled on the queue */
static const bool queue_idling_enabled[] = {
	true,	/* ROWQ_PRIO_HIGH_READ */
	true,	/* ROWQ_PRIO_REG_READ */
	false,	/* ROWQ_PRIO_HIGH_SWRITE */
	false,	/* ROWQ_PRIO_REG_SWRITE */
	false,	/* ROWQ_PRIO_REG_WRITE */
	false,	/* ROWQ_PRIO_LOW_READ */
	false,	/* ROWQ_PRIO_LOW_SWRITE */
};

/* Flags indicating whether the queue can notify on urgent requests */
static const bool urgent_queues[] = {
	true,	/* ROWQ_PRIO_HIGH_READ */
	true,	/* ROWQ_PRIO_REG_READ */
	false,	/* ROWQ_PRIO_HIGH_SWRITE */
	false,	/* ROWQ_PRIO_REG_SWRITE */
	false,	/* ROWQ_PRIO_REG_WRITE */
	false,	/* ROWQ_PRIO_LOW_READ */
	false,	/* ROWQ_PRIO_LOW_SWRITE */
/**
 * struct row_queue_params - ROW queue parameters
 * @idling_enabled: Flag indicating whether idling is enable on
 *			the queue
 * @quantum: Number of requests to be dispatched from this queue
 *			in a dispatch cycle
 * @is_urgent: Flags indicating whether the queue can notify on
 *			urgent requests
 *
 */
struct row_queue_params {
	bool idling_enabled;
	int quantum;
	bool is_urgent;
};

/* Default values for row queues quantums in each dispatch cycle */
static const int queue_quantum[] = {
	100,	/* ROWQ_PRIO_HIGH_READ */
	100,	/* ROWQ_PRIO_REG_READ */
	2,	/* ROWQ_PRIO_HIGH_SWRITE */
	1,	/* ROWQ_PRIO_REG_SWRITE */
	1,	/* ROWQ_PRIO_REG_WRITE */
	1,	/* ROWQ_PRIO_LOW_READ */
	1	/* ROWQ_PRIO_LOW_SWRITE */
/*
 * This array holds the default values of the different configurables
 * for each ROW queue. Each row of the array holds the following values:
 * {idling_enabled, quantum, is_urgent}
 * Each row corresponds to a queue with the same index (according to
 * enum row_queue_prio)
 */
static const struct row_queue_params row_queues_def[] = {
/* idling_enabled, quantum, is_urgent */
	{true, 100, true},	/* ROWQ_PRIO_HIGH_READ */
	{true, 100, true},	/* ROWQ_PRIO_REG_READ */
	{false, 2, false},	/* ROWQ_PRIO_HIGH_SWRITE */
	{false, 1, false},	/* ROWQ_PRIO_REG_SWRITE */
	{false, 1, false},	/* ROWQ_PRIO_REG_WRITE */
	{false, 1, false},	/* ROWQ_PRIO_LOW_READ */
	{false, 1, false}	/* ROWQ_PRIO_LOW_SWRITE */
};

/* Default values for idling on read queues (in msec) */
@@ -281,7 +282,7 @@ static void row_add_request(struct request_queue *q,
	rqueue->nr_req++;
	rq_set_fifo_time(rq, jiffies); /* for statistics*/

	if (queue_idling_enabled[rqueue->prio]) {
	if (row_queues_def[rqueue->prio].idling_enabled) {
		if (delayed_work_pending(&rd->read_idle.idle_work))
			(void)cancel_delayed_work(
				&rd->read_idle.idle_work);
@@ -297,7 +298,7 @@ static void row_add_request(struct request_queue *q,

		rqueue->idle_data.last_insert_time = ktime_get();
	}
	if (urgent_queues[rqueue->prio] &&
	if (row_queues_def[rqueue->prio].is_urgent &&
	    row_rowq_unserved(rd, rqueue->prio)) {
		row_log_rowq(rd, rqueue->prio,
			"added urgent request (total on queue=%d)",
@@ -352,7 +353,7 @@ static bool row_urgent_pending(struct request_queue *q)
	int i;

	for (i = 0; i < ROWQ_MAX_PRIO; i++)
		if (urgent_queues[i] && row_rowq_unserved(rd, i) &&
		if (row_queues_def[i].is_urgent && row_rowq_unserved(rd, i) &&
		    !list_empty(&rd->row_queues[i].fifo)) {
			row_log_rowq(rd, i,
				     "Urgent request pending (curr=%i)",
@@ -493,7 +494,7 @@ static int row_dispatch_requests(struct request_queue *q, int force)
			}
		}

		if (!force && queue_idling_enabled[currq] &&
		if (!force && row_queues_def[currq].idling_enabled &&
		    rd->row_queues[currq].idle_data.begin_idling) {
			if (!queue_delayed_work(rd->read_idle.idle_workqueue,
						&rd->read_idle.idle_work,
@@ -542,7 +543,7 @@ static int row_init_queue(struct request_queue *q)

	for (i = 0; i < ROWQ_MAX_PRIO; i++) {
		INIT_LIST_HEAD(&rdata->row_queues[i].fifo);
		rdata->row_queues[i].disp_quantum = queue_quantum[i];
		rdata->row_queues[i].disp_quantum = row_queues_def[i].quantum;
		rdata->row_queues[i].rdata = rdata;
		rdata->row_queues[i].prio = i;
		rdata->row_queues[i].idle_data.begin_idling = false;