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) ...@@ -95,16 +95,10 @@ void dput(struct dentry *dentry)
* more memory, or simply when we need to unmount * more memory, or simply when we need to unmount
* something (at which point we need to unuse * something (at which point we need to unuse
* all dentries). * 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 */ for (;;) {
nr <<= 6; nr >>= priority;
do {
struct dentry *dentry; struct dentry *dentry;
struct list_head *tmp = dentry_unused.prev; struct list_head *tmp = dentry_unused.prev;
...@@ -128,7 +122,7 @@ void shrink_dcache(int priority) ...@@ -128,7 +122,7 @@ void shrink_dcache(int priority)
d_free(dentry); d_free(dentry);
dput(parent); dput(parent);
} }
} while (--nr); }
} }
#define NAME_ALLOC_LEN(len) ((len+16) & ~15) #define NAME_ALLOC_LEN(len) ((len+16) & ~15)
......
...@@ -61,7 +61,7 @@ extern void d_delete(struct dentry *); ...@@ -61,7 +61,7 @@ extern void d_delete(struct dentry *);
/* allocate/de-allocate */ /* allocate/de-allocate */
extern void d_free(struct dentry *); extern void d_free(struct dentry *);
extern struct dentry * d_alloc(struct dentry * parent, const struct qstr *name); 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 */ /* only used at mount-time */
extern struct dentry * d_alloc_root(struct inode * root_inode, struct dentry * old_root); 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) ...@@ -362,15 +362,21 @@ static inline int do_try_to_free_page(int priority, int dma, int wait)
return 1; return 1;
state = 1; state = 1;
case 1: case 1:
if (kmem_cache_reap(i, dma, wait)) shrink_dcache();
return 1;
state = 2; state = 2;
case 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; return 1;
state = 3; state = 3;
case 3: case 3:
shrink_dcache(i); if (shm_swap(i, dma))
return 1;
state = 4; state = 4;
default: default:
if (swap_out(i, dma, wait)) 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