Blockbackingdevc

void set_bdi_congested(struct backing_dev_info *bdi, int rw) {

enum bdi_state bit;

bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested; set_bit(bit, &bdi->state);

However, the kernel is also responsible for adding processes waiting on a congested queue to the congestion_wqh wait queue. I describe how this is done shortly.

The function used to clear congestion on a queue is clear_queue_congested and is not much more complicated. Again, it is invoked at just one point in the kernel6 by _freed_request, which is in the code path originating from blk_put_request that returns request instances no longer needed to the kernel cache. At this point, it is easy to check whether the number of free requests has exceeded the above threshold for clearing congestion.

Once the congested bit for the desired direction has been deleted, a process waiting on the congestion_wqh queue to perform I/O operations is woken by the wake_up function described in Chapter 14. Recall that clear_queue_congested is just a front end for clear_bdi_congested:

Continue reading here: Waiting on Congested Queues

Was this article helpful?

0 0