Problems with your vmscan.c change (Re: [PATCH] VM improvements for

Benjamin Redelings I (bredelin@ucsd.edu)
Sun, 06 Dec 1998 14:29:09 -0800


Hi Rik,
I am somewhat concerned about this part of your patch:

--------------
if (buffer_over_borrow() || pgcache_over_borrow())
state = 0;
+ if (atomic_read(&nr_async_pages) > pager_daemon.swap_cluster /
2)
+ shrink_mmap(i, gfp_mask);
------------------

I have tried this patch, and I didn't experience any problems with it.
But, as somebody (Andrea, I think) pointed out, do_try_to_free_page
should return as soon as it frees one page; your patch breaks that
behaviour, doesn't it? Somehow it seems like a hack that fixes the
symptom instead of the problem.
Isn't the real problem that the state in do_try_to_free_page (DTTFP) is
too simple? I think that must be true if DTTFP gets stuck swapping and
never tries shrink_mmap, because it does not know when to go back to
state=0.
Does that sound correct?
-BenRI

P.S.

Here is an idea for how to fix your patch to free only one page
minimum. (I haven't tried to compile it). It is a bit ugly...

static int do_try_to_free_page(int gfp_mask)
{
static int state = 0;
int i=6;

/* Always trim SLAB caches when memory gets low. */
kmem_cache_reap(gfp_mask);

if (buffer_over_borrow() || pgcache_over_borrow())
state = 0;

switch (state) {
do {
case 0:
if (shrink_mmap(i, gfp_mask))
return 1;
state = 1;
case 1:
if (shm_swap(i, gfp_mask))
return 1;
state = 2;
case 2:
if (swap_out(i, gfp_mask)) {
if (atomic_read(&nr_async_pages) >
pager_daemon.swap_cluster / 2)
state = 3
return 1;
}
state = 4;
case 3:
state = 2;
if (shrink_mmap(i, gfp_mask))
return 1;
case 4:
shrink_dcache_memory(i, gfp_mask);
state = 0;
i--;
} while (i >= 0);
}
return 0;
}

-- 
If E. Coli was a computer:
 "OPERON.DLL: Mutation in LACTOSE.DLL.  Entire system halted."

Benjamin Redelings I <>< http://sdcc13.ucsd.edu/~bredelin

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