Re: [patch 00/12] Slab defragmentation V3

Christoph Lameter
2007-06-08T18:16:23Z

On Fri, 8 Jun 2007, Michal Piotrowski wrote:

> bash shared mapping + your script in a loop
> while true; do sudo ./run.sh; done > res3.txt

Hmmmm... Seems to be triggered from the reclaim path kmem_cache_defrag
rather than the manual triggered one from the script. Taking the slub_lock
on the reclaim path is an issue it seems.

Maybe we need to do a trylock in kmem_cache_defrag to defuse the
situation? This is after all an optimization so we can bug out.

Does this fix it?

---
mm/slub.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Index: slub/mm/slub.c
===================================================================
--- slub.orig/mm/slub.c 2007-06-08 11:12:40.000000000 -0700
+++ slub/mm/slub.c 2007-06-08 11:14:34.000000000 -0700
@@ -2738,7 +2738,9 @@ int kmem_cache_defrag(int percent, int n
unsigned long pages = 0;
void *scratch;

- down_read(&slub_lock);
+ if (!down_read_trylock(&slub_lock))
+ return 0;
+
list_for_each_entry(s, &slab_caches, list) {

/*