Commit 1a40868e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] misc fixes

There are a few VM-related patches in this series.  Mainly fixes;
feature work is on hold.

We have some fairly serious locking contention problems with the reverse
mapping's pte_chains.  Until we have a clear way out of that I believe
that it is best to not merge code which has a lot of rmap dependency.

It is apparent that these problems will not be solved by tweaking -
some redesign is needed.  In the 2.5 timeframe the only practical
solution appears to be page table sharing, based on Daniel's February
work.  Daniel and Dave McCracken are working that.

Some bits and pieces here:

- list_splice() has an open-coded list_empty() in it.  Use
  list_empty() instead.

- in shrink_cache() we have a local `nr_pages' which shadows another
  local.  Rename the inner one.  (Nikita Danilov)

- Add a BUG() on a can't-happen code path in page_remove_rmap().

- Tighten up the bug checks in the BH completion handlers - if the
  buffer is still under IO then it must be locked, because we unlock it
  inside the page_uptodate_lock.
parent 4e3663d7
......@@ -514,9 +514,8 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
if (!buffer_uptodate(tmp))
page_uptodate = 0;
if (buffer_async_read(tmp)) {
if (buffer_locked(tmp))
goto still_busy;
BUG();
BUG_ON(!buffer_locked(tmp));
goto still_busy;
}
tmp = tmp->b_this_page;
} while (tmp != bh);
......@@ -564,9 +563,8 @@ static void end_buffer_async_write(struct buffer_head *bh, int uptodate)
tmp = bh->b_this_page;
while (tmp != bh) {
if (buffer_async_write(tmp)) {
if (buffer_locked(tmp))
goto still_busy;
BUG();
BUG_ON(!buffer_locked(tmp));
goto still_busy;
}
tmp = tmp->b_this_page;
}
......
......@@ -156,9 +156,7 @@ static inline void __list_splice(list_t *list, list_t *head)
*/
static inline void list_splice(list_t *list, list_t *head)
{
list_t *first = list->next;
if (first != list)
if (!list_empty(list))
__list_splice(list, head);
}
......
......@@ -205,6 +205,8 @@ void page_remove_rmap(struct page * page, pte_t * ptep)
}
printk("\n");
printk(KERN_ERR "page_remove_rmap: driver cleared PG_reserved ?\n");
#else
BUG();
#endif
out:
......
......@@ -200,8 +200,8 @@ shrink_cache(int nr_pages, zone_t *classzone,
* so the direct writes to the page cannot get lost.
*/
int (*writeback)(struct page *, int *);
const int nr_pages = SWAP_CLUSTER_MAX;
int nr_to_write = nr_pages;
const int cluster_size = SWAP_CLUSTER_MAX;
int nr_to_write = cluster_size;
writeback = mapping->a_ops->vm_writeback;
if (writeback == NULL)
......@@ -209,7 +209,7 @@ shrink_cache(int nr_pages, zone_t *classzone,
page_cache_get(page);
spin_unlock(&pagemap_lru_lock);
(*writeback)(page, &nr_to_write);
max_scan -= (nr_pages - nr_to_write);
max_scan -= (cluster_size - nr_to_write);
page_cache_release(page);
spin_lock(&pagemap_lru_lock);
continue;
......
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