From: "Kirill A. Shutemov" <kirill@shutemov.name> To: Richard Weinberger <richard@nod.at> Cc: Christoph Hellwig <hch@infradead.org>, linux-fsdevel <linux-fsdevel@vger.kernel.org>, "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>, "linux-mm@kvack.org" <linux-mm@kvack.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Boris Brezillon <boris.brezillon@free-electrons.com>, Maxime Ripard <maxime.ripard@free-electrons.com>, David Gstir <david@sigma-star.at>, Dave Chinner <david@fromorbit.com>, Artem Bityutskiy <dedekind1@gmail.com>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Alexander Kaplan <alex@nextthing.co> Subject: Re: Page migration issue with UBIFS Date: Wed, 16 Mar 2016 17:21:56 +0300 [thread overview] Message-ID: <20160316142156.GA23595@node.shutemov.name> (raw) In-Reply-To: <56E8985A.1020509@nod.at> On Wed, Mar 16, 2016 at 12:18:50AM +0100, Richard Weinberger wrote: > Am 15.03.2016 um 16:37 schrieb Christoph Hellwig: > > On Tue, Mar 15, 2016 at 04:32:40PM +0100, Richard Weinberger wrote: > >>> Or if ->page_mkwrite() was called, why the page is not dirty? > >> > >> BTW: UBIFS does not implement ->migratepage(), could this be a problem? > > > > This might be the reason. I can't reall make sense of > > buffer_migrate_page, but it seems to migrate buffer_head state to > > the new page. > > > > I'd love to know why CMA even tries to migrate pages that don't have a > > ->migratepage method, this seems incredibly dangerous to me. > > FYI, with a dummy ->migratepage() which returns only -EINVAL UBIFS does no > longer explode upon page migration. > Tomorrow I'll do more tests to make sure. Could you check if something like this would fix the issue. Completely untested. diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 065c88f8e4b8..9da34120dc5e 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -52,6 +52,7 @@ #include "ubifs.h" #include <linux/mount.h> #include <linux/slab.h> +#include <linux/migrate.h> static int read_block(struct inode *inode, void *addr, unsigned int block, struct ubifs_data_node *dn) @@ -1452,6 +1453,20 @@ static int ubifs_set_page_dirty(struct page *page) return ret; } +static int ubifs_migrate_page(struct address_space *mapping, + struct page *newpage, struct page *page, enum migrate_mode mode) +{ + if (PagePrivate(page)) { + SetPagePrivate(newpage); + __set_page_dirty_nobuffers(newpage); + } + + if (PageChecked(page)) + SetPageChecked(newpage); + + return migrate_page(mapping, newpage, page, mode); +} + static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags) { /* @@ -1591,6 +1606,7 @@ const struct address_space_operations ubifs_file_address_operations = { .write_end = ubifs_write_end, .invalidatepage = ubifs_invalidatepage, .set_page_dirty = ubifs_set_page_dirty, + .migratepage = ubifs_migrate_page, .releasepage = ubifs_releasepage, }; -- Kirill A. Shutemov
WARNING: multiple messages have this Message-ID (diff)
From: "Kirill A. Shutemov" <kirill@shutemov.name> To: Richard Weinberger <richard@nod.at> Cc: Christoph Hellwig <hch@infradead.org>, linux-fsdevel <linux-fsdevel@vger.kernel.org>, "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>, "linux-mm@kvack.org" <linux-mm@kvack.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Boris Brezillon <boris.brezillon@free-electrons.com>, Maxime Ripard <maxime.ripard@free-electrons.com>, David Gstir <david@sigma-star.at>, Dave Chinner <david@fromorbit.com>, Artem Bityutskiy <dedekind1@gmail.com>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Alexander Kaplan <alex@nextthing.co> Subject: Re: Page migration issue with UBIFS Date: Wed, 16 Mar 2016 17:21:56 +0300 [thread overview] Message-ID: <20160316142156.GA23595@node.shutemov.name> (raw) In-Reply-To: <56E8985A.1020509@nod.at> On Wed, Mar 16, 2016 at 12:18:50AM +0100, Richard Weinberger wrote: > Am 15.03.2016 um 16:37 schrieb Christoph Hellwig: > > On Tue, Mar 15, 2016 at 04:32:40PM +0100, Richard Weinberger wrote: > >>> Or if ->page_mkwrite() was called, why the page is not dirty? > >> > >> BTW: UBIFS does not implement ->migratepage(), could this be a problem? > > > > This might be the reason. I can't reall make sense of > > buffer_migrate_page, but it seems to migrate buffer_head state to > > the new page. > > > > I'd love to know why CMA even tries to migrate pages that don't have a > > ->migratepage method, this seems incredibly dangerous to me. > > FYI, with a dummy ->migratepage() which returns only -EINVAL UBIFS does no > longer explode upon page migration. > Tomorrow I'll do more tests to make sure. Could you check if something like this would fix the issue. Completely untested. diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 065c88f8e4b8..9da34120dc5e 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -52,6 +52,7 @@ #include "ubifs.h" #include <linux/mount.h> #include <linux/slab.h> +#include <linux/migrate.h> static int read_block(struct inode *inode, void *addr, unsigned int block, struct ubifs_data_node *dn) @@ -1452,6 +1453,20 @@ static int ubifs_set_page_dirty(struct page *page) return ret; } +static int ubifs_migrate_page(struct address_space *mapping, + struct page *newpage, struct page *page, enum migrate_mode mode) +{ + if (PagePrivate(page)) { + SetPagePrivate(newpage); + __set_page_dirty_nobuffers(newpage); + } + + if (PageChecked(page)) + SetPageChecked(newpage); + + return migrate_page(mapping, newpage, page, mode); +} + static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags) { /* @@ -1591,6 +1606,7 @@ const struct address_space_operations ubifs_file_address_operations = { .write_end = ubifs_write_end, .invalidatepage = ubifs_invalidatepage, .set_page_dirty = ubifs_set_page_dirty, + .migratepage = ubifs_migrate_page, .releasepage = ubifs_releasepage, }; -- Kirill A. Shutemov -- 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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-03-16 14:22 UTC|newest] Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-03-15 14:16 Page migration issue with UBIFS Richard Weinberger 2016-03-15 14:16 ` Richard Weinberger 2016-03-15 15:17 ` Kirill A. Shutemov 2016-03-15 15:17 ` Kirill A. Shutemov 2016-03-15 15:25 ` Richard Weinberger 2016-03-15 15:25 ` Richard Weinberger 2016-03-15 15:35 ` Christoph Hellwig 2016-03-15 15:35 ` Christoph Hellwig 2016-03-15 15:47 ` Kirill A. Shutemov 2016-03-15 15:47 ` Kirill A. Shutemov 2016-03-15 15:32 ` Richard Weinberger 2016-03-15 15:32 ` Richard Weinberger 2016-03-15 15:37 ` Christoph Hellwig 2016-03-15 15:37 ` Christoph Hellwig 2016-03-15 16:02 ` Richard Weinberger 2016-03-15 16:02 ` Richard Weinberger 2016-03-15 23:18 ` Richard Weinberger 2016-03-15 23:18 ` Richard Weinberger 2016-03-16 14:21 ` Kirill A. Shutemov [this message] 2016-03-16 14:21 ` Kirill A. Shutemov 2016-03-16 14:27 ` Kirill A. Shutemov 2016-03-16 14:27 ` Kirill A. Shutemov 2016-03-16 20:47 ` Richard Weinberger 2016-03-16 20:47 ` Richard Weinberger 2016-03-16 22:55 ` [PATCH] UBIFS: Implement ->migratepage() Richard Weinberger 2016-03-16 22:55 ` Richard Weinberger 2016-03-16 23:12 ` kbuild test robot 2016-03-16 23:12 ` kbuild test robot 2016-03-17 4:39 ` kbuild test robot 2016-03-17 4:39 ` kbuild test robot 2016-03-17 8:09 ` Richard Weinberger 2016-03-17 8:09 ` Richard Weinberger 2016-03-17 9:57 ` Vlastimil Babka 2016-03-17 9:57 ` Vlastimil Babka 2016-03-25 22:53 ` Richard Weinberger 2016-03-25 22:53 ` Richard Weinberger 2016-03-17 7:11 ` Page migration issue with UBIFS Joonsoo Kim 2016-03-17 7:11 ` Joonsoo Kim 2016-03-17 8:13 ` Richard Weinberger 2016-03-17 8:13 ` Richard Weinberger 2016-03-17 15:17 ` Joonsoo Kim 2016-03-17 15:17 ` Joonsoo Kim 2016-03-21 23:00 ` Andrew Morton 2016-03-21 23:00 ` Andrew Morton 2016-03-21 23:06 ` Richard Weinberger 2016-03-21 23:06 ` Richard Weinberger 2016-03-21 15:28 ` Christoph Hellwig 2016-03-21 15:28 ` Christoph Hellwig 2016-03-17 15:25 ` Boris Brezillon 2016-03-17 15:25 ` Boris Brezillon
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20160316142156.GA23595@node.shutemov.name \ --to=kirill@shutemov.name \ --cc=alex@nextthing.co \ --cc=boris.brezillon@free-electrons.com \ --cc=david@fromorbit.com \ --cc=david@sigma-star.at \ --cc=dedekind1@gmail.com \ --cc=hch@infradead.org \ --cc=kirill.shutemov@linux.intel.com \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=linux-mtd@lists.infradead.org \ --cc=maxime.ripard@free-electrons.com \ --cc=richard@nod.at \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.