Re: [ck] Re: [PATCH] mm: yield during swap prefetching

Andreas Mohr
2006-03-08T08:48:31Z

Hi,

On Tue, Mar 07, 2006 at 03:26:36PM -0800, Andrew Morton wrote:
> Con Kolivas <kernel@kolivas.org> wrote:
> >
> > Swap prefetching doesn't use very much cpu but spends a lot of time waiting on
> > disk in uninterruptible sleep. This means it won't get preempted often even at
> > a low nice level since it is seen as sleeping most of the time. We want to
> > minimise its cpu impact so yield where possible.

> yield() really sucks if there are a lot of runnable tasks. And the amount
> of CPU which that thread uses isn't likely to matter anyway.
>
> I think it'd be better to just not do this. Perhaps alter the thread's
> static priority instead? Does the scheduler have a knob which can be used
> to disable a tasks's dynamic priority boost heuristic?

This problem occurs due to giving a priority boost to processes that are
sleeping a lot (e.g. in this case, I/O, from disk), right?
Forgive me my possibly less insightful comments, but maybe instead of adding
crude specific hacks (namely, yield()) to each specific problematic process as
it comes along (it just happens to be the swap prefetch thread this time)
there is a *general way* to give processes with lots of disk I/O sleeping
much smaller amounts of boost in order to get them preempted more often
in favour of an actually much more critical process (game)?
>From the discussion here it seems this problem is caused by a *general*
miscalculation of processes sleeping on disk I/O a lot.

Thus IMHO this problem should be solved in a general way if at all possible.

Andreas Mohr