Re: [Patch] shmem_unuse race fix

From: Marcelo Tosatti (marcelo@conectiva.com.br)
Date: Wed Dec 27 2000 - 10:14:41 EST


On 27 Dec 2000, Christoph Rohland wrote:

> BTW: The generic swapoff path itself has still races if a process is
> paging in a page which is just freed on swap by try_to_unuse. It gives
> 'VM: bad swap entries' and worse. But this is not shmem
> specific. Marcelo would you like to look into this?

Sure.

Look at this comment on try_to_unuse():

             swap_device_lock(si);
             for (i = 1; i < si->max ; i++) {
                 if (si->swap_map[i] > 0 && si->swap_map[i] != SWAP_MAP_BAD) {
                                /*
                                 * Prevent swaphandle from being completely
                                 * unused by swap_free while we are trying
                                 * to read in the page - this prevents warning
                                 * messages from rw_swap_page_base.
                                 */
                                if (si->swap_map[i] != SWAP_MAP_MAX)
                                        si->swap_map[i]++;
                                swap_device_unlock(si);
                                goto found_entry;
...

I think that incrementing the swap entry count will not allow swap from
removing the swap entry (as the comment says)

What I'm missing here?

Thanks

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



This archive was generated by hypermail 2b29 : Sun Dec 31 2000 - 21:00:10 EST