Re: [PATCH v7 9/9] block: Avoid deadlocks with bio allocation bystacking drivers

From: Tejun Heo
Date: Tue Sep 04 2012 - 14:55:32 EST


Hello, Mikulas, Kent.

On Mon, Sep 03, 2012 at 08:41:00PM -0700, Kent Overstreet wrote:
> On Mon, Sep 03, 2012 at 04:41:37PM -0400, Mikulas Patocka wrote:
> > ... or another possibility - start a timer when something is put to
> > current->bio_list and use that timer to pop entries off current->bio_list
> > and submit them to a workqueue. The timer can be cpu-local so only
> > interrupt masking is required to synchronize against the timer.
> >
> > This would normally run just like the current kernel and in case of
> > deadlock, the timer would kick in and resolve the deadlock.
>
> Ugh. That's a _terrible_ idea.

That's exactly how workqueue rescuers work - rescuers kick in if new
worker creation doesn't succeed in given amount of time. The
suggested mechanism already makes use of workqueue, so it's already
doing it. If you can think of a better way to detect the generic
stall condition, please be my guest.

> Remember the old plugging code? You ever have to debug performance
> issues caused by it?

That is not equivalent. Plugging was kicking in all the time and it
wasn't entirely well-defined what the plugging / unplugging conditions
were. This type of rescuing for forward-progress guarantee only kicks
in under severe memory pressure and people expect finite latency and
throughput hits under such conditions. The usual bio / request /
scsi_cmd allocations could be failing under these circumstances and
things could be progressing only thanks to the finite preallocated
pools. I don't think involving rescue timer would be noticeably
deterimental.

Actually, if the timer approach can reduce the frequency of rescuer
involvement, I think it could actually be better.

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/