On Thu, 12 Nov 1998 19:32:35 +0200 (IST), Amnon Shiloh
<amnons@cs.huji.ac.il> said:
> /* Run the hooks that have to be done when a page I/O has completed. */
> static inline void after_unlock_page (struct page * page)
> {
...
> + if(PageFreeAfter(page) && PageSwapCache(page) &&
> + atomic_read(&page->count) == 2)
> + delete_from_swap_cache(page);
> swap_after_unlock_page(page->offset);
No no no! You can't do this. The data structures manipulated by
delete_from_swap_cache are not interrupt safe, so they cannot be
modified by after_unlock_page().
When I wrote this code I made a deliberate decision not to address this
particular situation, *precisely* because we cannot safely do so without
making the whole of the swap map (not just the lock map)
interrupt-safe. I just didn't think it was worth the penalty, because
the swap map is performance-critical (it gets exercised heavily during
fork()/exec()/exit(), even if there is no IO involved). Leaving the
pages for shrink_mmap() to deal with is overall faster than polluting
the swap map code with interrupt/spinlock protection.
--Stephen
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/