From: Vlastimil Babka <vbabka@suse.cz>
To: Richard Weinberger <richard@nod.at>, linux-mtd@lists.infradead.org
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" <kirill.shutemov@linux.intel.com>,
Hugh Dickins <hughd@google.com>,
Mel Gorman <mgorman@techsingularity.net>
Subject: Re: [PATCH] UBIFS: Implement ->migratepage()
Date: Thu, 17 Mar 2016 10:57:41 +0100 [thread overview]
Message-ID: <56EA7F95.4090703@suse.cz> (raw)
In-Reply-To: <1458168919-11597-1-git-send-email-richard@nod.at>
+CC Hugh, Mel
On 03/16/2016 11:55 PM, Richard Weinberger wrote:
> From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
>
> 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.
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> [rw: Massaged changelog]
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
> fs/ubifs/file.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
> index 0edc128..48b2944 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,24 @@ 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)
> +{
> + int rc;
> +
> + rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode, 0);
> + if (rc != MIGRATEPAGE_SUCCESS)
> + return rc;
> +
> + if (PagePrivate(page)) {
> + ClearPagePrivate(page);
> + SetPagePrivate(newpage);
> + }
> +
> + migrate_page_copy(newpage, page);
> + return MIGRATEPAGE_SUCCESS;
> +}
> +
> static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags)
> {
> /*
> @@ -1591,6 +1610,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,
> };
>
>
WARNING: multiple messages have this Message-ID (diff)
From: Vlastimil Babka <vbabka@suse.cz>
To: Richard Weinberger <richard@nod.at>, linux-mtd@lists.infradead.org
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" <kirill.shutemov@linux.intel.com>,
Hugh Dickins <hughd@google.com>,
Mel Gorman <mgorman@techsingularity.net>
Subject: Re: [PATCH] UBIFS: Implement ->migratepage()
Date: Thu, 17 Mar 2016 10:57:41 +0100 [thread overview]
Message-ID: <56EA7F95.4090703@suse.cz> (raw)
In-Reply-To: <1458168919-11597-1-git-send-email-richard@nod.at>
+CC Hugh, Mel
On 03/16/2016 11:55 PM, Richard Weinberger wrote:
> From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
>
> 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.
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> [rw: Massaged changelog]
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
> fs/ubifs/file.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
> index 0edc128..48b2944 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,24 @@ 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)
> +{
> + int rc;
> +
> + rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode, 0);
> + if (rc != MIGRATEPAGE_SUCCESS)
> + return rc;
> +
> + if (PagePrivate(page)) {
> + ClearPagePrivate(page);
> + SetPagePrivate(newpage);
> + }
> +
> + migrate_page_copy(newpage, page);
> + return MIGRATEPAGE_SUCCESS;
> +}
> +
> static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags)
> {
> /*
> @@ -1591,6 +1610,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,
> };
>
>
--
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-17 9:58 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
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 [this message]
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=56EA7F95.4090703@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=alex@nextthing.co \
--cc=boris.brezillon@free-electrons.com \
--cc=david@fromorbit.com \
--cc=david@sigma-star.at \
--cc=dedekind1@gmail.com \
--cc=hughd@google.com \
--cc=iamjoonsoo.kim@lge.com \
--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=mgorman@techsingularity.net \
--cc=richard@nod.at \
--cc=rvaswani@codeaurora.org \
--cc=sasha.levin@oracle.com \
--cc=shailendra.capricorn@gmail.com \
--cc=tony.luck@intel.com \
/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: link
Be 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.