Skip to content

Commit 32c59e3

Browse files
Algodev-githubaxboe
authored andcommitted
block, bfq: do not insert oom queue into position tree
BFQ maintains an ordered list, implemented with an RB tree, of head-request positions of non-empty bfq_queues. This position tree, inherited from CFQ, is used to find bfq_queues that contain I/O close to each other. BFQ merges these bfq_queues into a single shared queue, if this boosts throughput on the device at hand. There is however a special-purpose bfq_queue that does not participate in queue merging, the oom bfq_queue. Yet, also this bfq_queue could be wrongly added to the position tree. So bfqq_find_close() could return the oom bfq_queue, which is a source of further troubles in an out-of-memory situation. This commit prevents the oom bfq_queue from being inserted into the position tree. Tested-by: Patrick Dung <[email protected]> Tested-by: Oleksandr Natalenko <[email protected]> Signed-off-by: Paolo Valente <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent f718b09 commit 32c59e3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

block/bfq-iosched.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,10 @@ bfq_pos_tree_add_move(struct bfq_data *bfqd, struct bfq_queue *bfqq)
613613
bfqq->pos_root = NULL;
614614
}
615615

616+
/* oom_bfqq does not participate in queue merging */
617+
if (bfqq == &bfqd->oom_bfqq)
618+
return;
619+
616620
/*
617621
* bfqq cannot be merged any longer (see comments in
618622
* bfq_setup_cooperator): no point in adding bfqq into the

0 commit comments

Comments
 (0)