Re: Linux-2.4.5

Andrea Arcangeli (andrea@suse.de)
Sat, 26 May 2001 18:04:13 +0200


On Sat, May 26, 2001 at 12:51:38PM -0300, Rik van Riel wrote:
> On Sat, 26 May 2001, Andrea Arcangeli wrote:
>
> > > > - /*
> > > > - * Set our state for sleeping, then check again for buffer heads.
> > > > - * This ensures we won't miss a wake_up from an interrupt.
> > > > - */
> > > > - wait_event(buffer_wait, nr_unused_buffer_heads >= MAX_BUF_PER_PAGE);
> > > > + current->policy |= SCHED_YIELD;
> > > > + __set_current_state(TASK_RUNNING);
> > > > + schedule();
> > > > goto try_again;
> > > > }
>
> I'm still curious ... is it _really_ needed to busy-spin here?

As said we cannot wait_event, because those reserved bh will be released
only by the VM if there is memory pressure. If we sleep in wait_event
while I/O is in progress on the reserved bh and a big chunk of memory is
released under us, then those reserved bh may never get released and we
will hang in wait_event until there's memory pressure again, so unless
we implement another logic we need to somehow poll there and to try to
allocate again later. We should enter that path very seldom so I'm not
very concerned about the performance during the polling loop.

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