Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754663AbcCYWx5 (ORCPT ); Fri, 25 Mar 2016 18:53:57 -0400 Received: from a.ns.miles-group.at ([95.130.255.143]:11949 "EHLO radon.swed.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754040AbcCYWxz (ORCPT ); Fri, 25 Mar 2016 18:53:55 -0400 Subject: Re: [PATCH] UBIFS: Implement ->migratepage() To: Vlastimil Babka , linux-mtd@lists.infradead.org References: <56E9C658.1020903@nod.at> <1458168919-11597-1-git-send-email-richard@nod.at> <56EA7F95.4090703@suse.cz> Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, boris.brezillon@free-electrons.com, maxime.ripard@free-electrons.com, david@sigma-star.at, david@fromorbit.com, dedekind1@gmail.com, alex@nextthing.co, akpm@linux-foundation.org, sasha.levin@oracle.com, iamjoonsoo.kim@lge.com, rvaswani@codeaurora.org, tony.luck@intel.com, shailendra.capricorn@gmail.com, "Kirill A. Shutemov" , Hugh Dickins , Mel Gorman From: Richard Weinberger Message-ID: <56F5C17A.2080707@nod.at> Date: Fri, 25 Mar 2016 23:53:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <56EA7F95.4090703@suse.cz> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2060 Lines: 44 Am 17.03.2016 um 10:57 schrieb Vlastimil Babka: > +CC Hugh, Mel > > On 03/16/2016 11:55 PM, Richard Weinberger wrote: >> From: "Kirill A. Shutemov" >> >> When using CMA during page migrations UBIFS might get confused > > It shouldn't be CMA specific, the same code runs from compaction, autonuma balancing... > >> and the following assert triggers: >> UBIFS assert failed in ubifs_set_page_dirty at 1451 (pid 436) >> >> UBIFS is using PagePrivate() which can have different meanings across >> filesystems. Therefore the generic page migration code cannot handle this >> case correctly. >> We have to implement our own migration function which basically does a >> plain copy but also duplicates the page private flag. > > Lack of PagePrivate() migration is surely a bug, but at a glance of how UBIFS uses the flag, it's more about accounting, it shouldn't prevent a page from being marked PageDirty()? > I suspect your initial bug (which is IIUC the fact that there's a dirty pte, but PageDirty(page) is false) comes from the generic fallback_migrate_page() which does: > > if (PageDirty(page)) { > /* Only writeback pages in full synchronous migration */ > if (mode != MIGRATE_SYNC) > return -EBUSY; > return writeout(mapping, page); > } > > And writeout() seems to Clear PageDirty() through clear_page_dirty_for_io() but I'm not so sure about the pte (or pte's in all rmaps). But this comment in the latter function: > > * Yes, Virginia, this is indeed insane. > > scared me enough to not investigate further. Hopefully the people I CC'd understand more about page migration than me. I'm just an user :) > > In any case, this patch would solve both lack of PageDirty() transfer, and avoid the path leading from fallback_migrate_page() to writeout(). But I'm not confident enough here to > ack it. Hugh? Mel? Anyone? :-) It is still not clear to me whether this needs fixing in MM or UBIFS. Thanks, //richard