Re: 2.1.97 mm and cache

Andrea Arcangeli (arcangel@CS.UniBO.IT)
Tue, 21 Apr 1998 13:17:36 +0200 (MET DST)


On Mon, 20 Apr 1998, Andrea Arcangeli wrote:

> I really don' t think the problems is the swap code. I think the problem
> is the cache allocating code. Only it. Then the swapping code try to free
> memory swapping all out. As ever I never got into mm details so I can be
> wrong.

My friend showed how 2.1.97 stall on its laptop with 8Mbyte of ram. So I
tried to develop something with that hardware. To hang 2.1.97 I need to
`cp -r linux tmp` and then run a `make mrproper` on a kernel tree as
suggested by my friend.

This patch seems to help (at the machine not more hang) but I really
don' t know if it could be right. It' s only an advice. As second this
patch try to remove the cache (I hope ;-) and not force the cache code to
not alloc it as it should be I think.

The patch format is -c since I have not -u here ;-(.

Andrea[s] Arcangeli

*** linux/mm/vmscan.c Thu Mar 26 22:44:07 1998
--- /public/arcangel/kernel/vmscan.c Tue Apr 21 13:02:17 1998
***************
*** 586,591 ****
--- 586,592 ----
run_task_queue(&tq_disk);

}
+ check_dcache_memory();
}
/* As if we could ever get here - maybe we want to make this killable */
remove_wait_queue(&kswapd_wait, &wait);
*** linux/fs/dcache.c Thu Apr 9 22:15:40 1998
--- /public/arcangel/kernel/dcache.c Tue Apr 21 13:02:18 1998
***************
*** 440,465 ****
void check_dcache_memory()
{
if (dentry_stat.want_pages) {
! unsigned int count, goal = 0;
/*
* Set the page goal. We don't necessarily need to trim
* the dcache just because the system needs memory ...
*/
! if (page_cache_size > (num_physpages >> 1))
! goal = (dentry_stat.want_pages * page_cache_size)
! / num_physpages;
dentry_stat.want_pages = 0;
! if (goal) {
! if (goal > 50)
! goal = 50;
! count = select_dcache(32, goal);
#ifdef DCACHE_DEBUG
printk(KERN_DEBUG "check_dcache_memory: goal=%d, count=%d\n", goal, count);
#endif
! if (count) {
! prune_dcache(count);
! free_inode_memory(count);
! }
}
}
}
--- 440,460 ----
void check_dcache_memory()
{
if (dentry_stat.want_pages) {
! unsigned int count, goal;
/*
* Set the page goal. We don't necessarily need to trim
* the dcache just because the system needs memory ...
*/
! goal = (10 * dentry_stat.want_pages * page_cache_size)
! / num_physpages;
dentry_stat.want_pages = 0;
! count = select_dcache(32, goal);
#ifdef DCACHE_DEBUG
printk(KERN_DEBUG "check_dcache_memory: goal=%d, count=%d\n", goal, count);
#endif
! if (count) {
! prune_dcache(count);
! free_inode_memory(count);
}
}
}
***************
*** 784,790 ****

error = -ENOENT;
/* Has the current directory has been unlinked? */
! if (pwd->d_parent == pwd || !list_empty(&pwd->d_hash)) {
char *page = (char *) __get_free_page(GFP_USER);
error = -ENOMEM;
if (page) {
--- 779,785 ----

error = -ENOENT;
/* Has the current directory has been unlinked? */
! if (pwd->d_parent != pwd && list_empty(&pwd->d_hash)) {
char *page = (char *) __get_free_page(GFP_USER);
error = -ENOMEM;
if (page) {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu