[Devel] [PATCH rh7] mm/tswap: fix lockup in tswap_evict_page()

Cyrill Gorcunov gorcunov at virtuozzo.com
Wed Jul 4 10:56:02 MSK 2018


On Tue, Jul 03, 2018 at 07:35:38PM +0300, Andrey Ryabinin wrote:
> Surprisingly after the upstream commit 7c00bafee87c
> ("mm/swap: free swap slots in batch"), backported
> by redhat, SWAP_HAS_CACHE in swap_info->swap_map[offset]
> doesn't mean that swap entry has a page in swap cache anymore.
> 
> Now we may set SWAP_HAS_CACHE even if we know that page is not cached.
> Commit 7c00bafee87c changed swapcache_free() so it will set SWAP_HAS_CACHE:
> -       p->swap_map[offset] = usage;
> +       p->swap_map[offset] = usage ? : SWAP_HAS_CACHE;
> 
> And it will be cleared only by swapcache_free_entries(), but swapcache_free_entries()
> call may be delayed indefinitely, until the 'swp_slots' per-cpu cache
> is full.
> 
> It's not that obvious, how to fix this mess. For now, I think, the safest
> course of action would be a workaround in the tswap, similar to what we
> do in __read_swap_cache_async() - bail out on zero swap_count. Apperently
> it works for __read_swap_cache_async(), so it should work for tswap.
> 
> https://jira.sw.ru/browse/PSBM-86344
> Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
Reviewed-by: Cyrill Gorcunov <gorcunov at openvz.org>


More information about the Devel mailing list