From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 26 Jan 2015 18:14:26 +0300 From: Cyrill Gorcunov To: Konstantin Khlebnikov Cc: linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org, Andrey Ryabinin , Stable , "Kirill A. Shutemov" , Naoya Horiguchi , Peter Feiner Subject: Re: [PATCH] proc/pagemap: walk page tables under pte lock Message-ID: <20150126151426.GU7377@moon> References: <20150126145214.11053.5670.stgit@buzz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150126145214.11053.5670.stgit@buzz> Sender: owner-linux-mm@kvack.org List-ID: On Mon, Jan 26, 2015 at 05:52:14PM +0300, Konstantin Khlebnikov wrote: > Lockless access to pte in pagemap_pte_range() might race with page migration > and trigger BUG_ON(!PageLocked()) in migration_entry_to_page(): > > CPU A (pagemap) CPU B (migration) > lock_page() > try_to_unmap(page, TTU_MIGRATION...) > make_migration_entry() > set_pte_at() > > pte_to_pagemap_entry() > remove_migration_ptes() > unlock_page() > if(is_migration_entry()) > migration_entry_to_page() > BUG_ON(!PageLocked(page)) > > Also lockless read might be non-atomic if pte is larger than wordsize. > Other pte walkers (smaps, numa_maps, clear_refs) already lock ptes. > > Signed-off-by: Konstantin Khlebnikov > Reported-by: Andrey Ryabinin > Fixes: 052fb0d635df ("proc: report file/anon bit in /proc/pid/pagemap") > Cc: Stable (v3.5+) Reviewed-by: Cyrill Gorcunov Thank you! -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org