static struct cfq_io_context *bfq_alloc_io_context(struct bfq_data *bfqd, gfp_t gfp_mask) { struct cfq_io_context *cic; cic = kmem_cache_alloc_node(bfq_ioc_pool, gfp_mask | __GFP_ZERO, bfqd->queue->node); if (cic != NULL) { cic->last_end_request = jiffies; INIT_LIST_HEAD(&cic->queue_list); INIT_HLIST_NODE(&cic->cic_list); cic->dtor = bfq_free_io_context; cic->exit = bfq_exit_io_context; elv_ioc_count_inc(bfq_ioc_count); } return cic; }
static struct cfq_io_context *bfq_alloc_io_context(struct bfq_data *bfqd, gfp_t gfp_mask) { struct cfq_io_context *cic; cic = kmem_cache_alloc_node(bfq_ioc_pool, gfp_mask | __GFP_ZERO, bfqd->queue->node); if (cic != NULL) { cic->last_end_request = jiffies; /* * A newly created cic indicates that the process has just * started doing I/O, and is probably mapping into memory its * executable and libraries: it definitely needs weight raising. * There is however the possibility that the process performs, * for a while, I/O close to some other process. EQM intercepts * this behavior and may merge the queue corresponding to the * process with some other queue, BEFORE the weight of the queue * is raised. Merged queues are not weight-raised (they are assumed * to belong to processes that benefit only from high throughput). * If the merge is basically the consequence of an accident, then * the queue will be split soon and will get back its old weight. * It is then important to write down somewhere that this queue * does need weight raising, even if it did not make it to get its * weight raised before being merged. To this purpose, we overload * the field raising_time_left and assign 1 to it, to mark the queue * as needing weight raising. */ cic->wr_time_left = 1; INIT_LIST_HEAD(&cic->queue_list); INIT_HLIST_NODE(&cic->cic_list); cic->dtor = bfq_free_io_context; cic->exit = bfq_exit_io_context; elv_ioc_count_inc(bfq_ioc_count); } return cic; }