Re: swsusp: clean up reading

From: Andrew Morton
Date: Sat Sep 11 2004 - 18:22:50 EST


Pavel Machek <pavel@xxxxxx> wrote:
>
> -static void wait_io(void)
> -{
> - while(atomic_read(&io_done))
> - io_schedule();
> -}
> -
> -
> static struct block_device * resume_bdev;
>
> ...
>
> - wait_io();
> + while (atomic_read(&io_done))
> + yield();

This doesn't seem to be much of an improvement, really. It still runs the
risk that the caller might have SCHIED_FIFO policy and we end up in a
spinloop until I/O completion.

Why not stick a `struct completion' at bio->bi_private, do complete() in
the end_io handler and wait_for_completion() in the caller?

I'll add the current patch to -mm for now, thanks.
-
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/