Please test: workaround to help swapoff behaviour

From: Marcelo Tosatti (marcelo@conectiva.com.br)
Date: Thu Jun 07 2001 - 12:43:58 EST


On Thu, 7 Jun 2001, Marcelo Tosatti wrote:

>
> On Thu, 7 Jun 2001, Mike Galbraith wrote:
>
> > On 6 Jun 2001, Eric W. Biederman wrote:
> >
> > > Mike Galbraith <mikeg@wen-online.de> writes:
> > >
> > > > > If you could confirm this by calling swapoff sometime other than at
> > > > > reboot time. That might help. Say by running top on the console.
> > > >
> > > > The thing goes comatose here too. SCHED_RR vmstat doesn't run, console
> > > > switch is nogo...
> > > >
> > > > After running his memory hog, swapoff took 18 seconds. I hacked a
> > > > bleeder valve for dead swap pages, and it dropped to 4 seconds.. still
> > > > utterly comatose for those 4 seconds though.
> > >
> > > At the top of the while(1) loop in try_to_unuse what happens if you put in.
> > > if (need_resched) schedule();
> > > It should be outside all of the locks. It might just be a matter of everything
> > > serializing on the SMP locks, and the kernel refusing to preempt itself.
> >
> > That did it.
>
> What about including this workaround in the kernel ?

Well,

This is for the people who has been experiencing the lockups while running
swapoff.

Please test. (against 2.4.6-pre1)

Thanks for the suggestion, Eric.

--- linux.orig/mm/swapfile.c Wed Jun 6 18:16:45 2001
+++ linux/mm/swapfile.c Thu Jun 7 16:06:11 2001
@@ -345,6 +345,8 @@
                 /*
                  * Find a swap page in use and read it in.
                  */
+ if (current->need_resched)
+ schedule();
                 swap_device_lock(si);
                 for (i = 1; i < si->max ; i++) {
                         if (si->swap_map[i] > 0 && si->swap_map[i] != SWAP_MAP_BAD) {

-
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/



This archive was generated by hypermail 2b29 : Thu Jun 07 2001 - 21:01:03 EST