Re: the new VMt

From: yodaiken@fsmlabs.com
Date: Mon Sep 25 2000 - 13:13:15 EST


On Mon, Sep 25, 2000 at 08:04:54PM +0200, Jamie Lokier wrote:
> yodaiken@fsmlabs.com wrote:
> > > yodaiken@fsmlabs.com wrote:
> > > > walk = out;
> > > > while(nfds > 0) {
> > > > poll_table *tmp = (poll_table *) __get_free_page(GFP_KERNEL);
> > > > if (!tmp) {
> > >
> > > Shouldn't this be GFP_USER? (Which would also conveniently fix the
> > > problem Victor's pointing out...)
> >
> > It should probably be GFP_ATOMIC, if I understand the mm right.
>
> Definitely not. GFP_ATOMIC is reserved for things that really can't
> swap or schedule right now. Use GFP_ATOMIC indiscriminately and you'll
> have to increase the number of atomic-allocatable pages.

Process 1,2 and 3 all start allocating 20 pages
      process 1 stalls after allocating 19
      some memory is freed and process 2 runs and stall after allocating 19
      some memory is free and process 3 runs and stalls after allocating 19
     
    now 57 pages are locked up in non-swapable kernel space and the system deadlocks OOM.

    
        
> > The algorithm for requesting a collection of reources and freeing all
> > of them on failure is simple, fast, and robust.
>
> Allocation is just as fast with GFP_KERNEL/USER, just less likely to

It's not speed, it's deadlock avoidance.

> fail and less likely to break something else that really needs
> GFP_ATOMIC allocations.

My point here is simply that error returns in memory allocation allow
higher level kernel operations to safely marshal a collection of resources following
a safe algorithm that is optimized for the case when there is no memory shortage
and that only starts going to the slow case when the system is stalling due to memory
shortages anyways.

>
> -- Jamie

-- 
---------------------------------------------------------
Victor Yodaiken 
Finite State Machine Labs: The RTLinux Company.
 www.fsmlabs.com  www.rtlinux.com

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



This archive was generated by hypermail 2b29 : Sat Sep 30 2000 - 21:00:15 EST