Re: Linux-2.4.5

Andrea Arcangeli
2001-05-26T23:22:17Z

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