Commit ca6ede75 authored by Linus Torvalds's avatar Linus Torvalds

Import 2.1.45pre5

parent 83e937d1
......@@ -95,16 +95,10 @@ void dput(struct dentry *dentry)
* more memory, or simply when we need to unmount
* something (at which point we need to unuse
* all dentries).
*
* "priority" is a value between 0-6, 0 means that
* we should work really hard on releasing stuff..
*/
void shrink_dcache(int priority)
void shrink_dcache(void)
{
int nr = 42; /* "random" number */
nr <<= 6; nr >>= priority;
do {
for (;;) {
struct dentry *dentry;
struct list_head *tmp = dentry_unused.prev;
......@@ -128,7 +122,7 @@ void shrink_dcache(int priority)
d_free(dentry);
dput(parent);
}
} while (--nr);
}
}
#define NAME_ALLOC_LEN(len) ((len+16) & ~15)
......
......@@ -61,7 +61,7 @@ extern void d_delete(struct dentry *);
/* allocate/de-allocate */
extern void d_free(struct dentry *);
extern struct dentry * d_alloc(struct dentry * parent, const struct qstr *name);
extern void shrink_dcache(int);
extern void shrink_dcache(void);
/* only used at mount-time */
extern struct dentry * d_alloc_root(struct inode * root_inode, struct dentry * old_root);
......
......@@ -362,15 +362,21 @@ static inline int do_try_to_free_page(int priority, int dma, int wait)
return 1;
state = 1;
case 1:
if (kmem_cache_reap(i, dma, wait))
return 1;
shrink_dcache();
state = 2;
case 2:
if (shm_swap(i, dma))
/*
* We shouldn't have a priority here:
* If we're low on memory we should
* unconditionally throw away _all_
* kmalloc caches!
*/
if (kmem_cache_reap(0, dma, wait))
return 1;
state = 3;
case 3:
shrink_dcache(i);
if (shm_swap(i, dma))
return 1;
state = 4;
default:
if (swap_out(i, dma, wait))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment