--- 2.3.99-pre3aa1-alpha/mm/filemap.c.~1~ Thu Mar 30 16:10:38 2000 +++ 2.3.99-pre3aa1-alpha/mm/filemap.c Thu Mar 30 18:24:29 2000 @@ -250,6 +250,11 @@ count--; dispose = &young; + + /* avoid unscalable SMP locking */ + if (!page->buffers && page_count(page) > 1) + goto dispose_continue; + if (TryLockPage(page)) goto dispose_continue; @@ -260,22 +265,11 @@ page locked down ;). */ spin_unlock(&pagemap_lru_lock); - /* avoid unscalable SMP locking */ - if (!page->buffers && page_count(page) > 1) - goto unlock_noput_continue; - - /* Take the pagecache_lock spinlock held to avoid - other tasks to notice the page while we are looking at its - page count. If it's a pagecache-page we'll free it - in one atomic transaction after checking its page count. */ - spin_lock(&pagecache_lock); - /* avoid freeing the page while it's locked */ get_page(page); /* Is it a buffer page? */ if (page->buffers) { - spin_unlock(&pagecache_lock); if (!try_to_free_buffers(page)) goto unlock_continue; /* page was locked, inode can't go away under us */ @@ -283,9 +277,14 @@ atomic_dec(&buffermem_pages); goto made_buffer_progress; } - spin_lock(&pagecache_lock); } + /* Take the pagecache_lock spinlock held to avoid + other tasks to notice the page while we are looking at its + page count. If it's a pagecache-page we'll free it + in one atomic transaction after checking its page count. */ + spin_lock(&pagecache_lock); + /* * We can't free pages unless there's just one user * (count == 2 because we added one ourselves above). @@ -326,12 +325,6 @@ spin_lock(&pagemap_lru_lock); UnlockPage(page); put_page(page); - list_add(page_lru, dispose); - continue; - -unlock_noput_continue: - spin_lock(&pagemap_lru_lock); - UnlockPage(page); list_add(page_lru, dispose); continue;