Re: page_launder() bug

Mikulas Patocka (mikulas@artax.karlin.mff.cuni.cz)
Tue, 8 May 2001 14:33:45 +0200 (CEST)


> > My point is that its _ok_ for us to check if the page is a dead swap cache
> > page _without_ the lock since writepage() will recheck again with the page
> > _locked_. Quoting you two messages back:
> >
> > "But it is important to re-calculate the deadness after getting the lock.
> > Before, it was just an informed guess. After the lock, it is knowledge."
> >
> > See ?
>
> In fact my patch isn't changing writepage behavior wrt. that page, it
> is changing behavior with respect to laundering policy for that page.
>
> Here, let's talk code a little bit so there are no misunderstandings,
> I really want to put this to rest:
>
> + int dead_swap_page;
> +
> page = list_entry(page_lru, struct page, lru);
>
> + dead_swap_page =
> + (PageSwapCache(page) &&
> + page_count(page) == (1 + !!page->buffers));
> +
>
> Calculate dead_swap_page outside of lock.
>
> /* Page is or was in use? Move it to the active list. */
> - if (PageTestandClearReferenced(page) || page->age > 0 ||
> - (!page->buffers && page_count(page) > 1) ||
> - page_ramdisk(page)) {
^^^^^^^^^^^^^^^^^
> + if (!dead_swap_page &&
> + (PageTestandClearReferenced(page) || page->age > 0 ||
> + (!page->buffers && page_count(page) > 1) ||
> + page_ramdisk(page))) {
^^^^^^^^^^^^^^^^^^^^^^
> del_page_from_inactive_dirty_list(page);
> add_page_to_active_list(page);
> continue;

#define page_ramdisk(page) \
(page->buffers && (MAJOR(page->buffers->b_dev) == RAMDISK_MAJOR))

Are you sure that no one will release buffers under your hands?

Mikulas

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/