[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1618433.IpySj692Hd@blindfold>
Date: Fri, 14 Dec 2018 12:25:50 +0100
From: Richard Weinberger <richard@....at>
To: zhangjun <openzhangj@...il.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
"Darrick J . Wong" <darrick.wong@...cle.com>, hch@....de,
bfoster@...hat.com, darrick.wong@...cle.com,
Dave Chinner <david@...morbit.com>, akpm@...ux-foundation.org,
kirill.shutemov@...ux.intel.com, mhocko@...e.com,
n-horiguchi@...jp.nec.com, mgorman@...hsingularity.net,
aarcange@...hat.com, willy@...radead.org,
linux@...inikbrodowski.net, linux-mm@...ck.org,
Gao Xiang <gaoxiang25@...wei.com>
Subject: Re: [PATCH] fix page_count in ->iomap_migrate_page()
[CC'ing authors of the code plus mm folks]
Am Freitag, 14. Dezember 2018, 06:56:01 CET schrieb zhangjun:
> IOMAP uses PG_private a little different with buffer_head based
> filesystem.
> It uses it as marker and when set, the page counter is not incremented,
> migrate_page_move_mapping() assumes that PG_private indicates a counter
> of +1.
> so, we have to pass a extra count of -1 to migrate_page_move_mapping()
> if the flag is set.
>
> Signed-off-by: zhangjun <openzhangj@...il.com>
> ---
> fs/iomap.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/fs/iomap.c b/fs/iomap.c
> index 64ce240..352e58a 100644
> --- a/fs/iomap.c
> +++ b/fs/iomap.c
> @@ -544,8 +544,17 @@ iomap_migrate_page(struct address_space *mapping, struct page *newpage,
> struct page *page, enum migrate_mode mode)
> {
> int ret;
> + int extra_count = 0;
>
> - ret = migrate_page_move_mapping(mapping, newpage, page, NULL, mode, 0);
> + /*
> + * IOMAP uses PG_private as marker and does not raise the page counter.
> + * migrate_page_move_mapping() expects a incremented counter if PG_private
> + * is set. Therefore pass -1 as extra_count for this case.
> + */
> + if (page_has_private(page))
> + extra_count = -1;
> + ret = migrate_page_move_mapping(mapping, newpage, page,
> + NULL, mode, extra_count);
> if (ret != MIGRATEPAGE_SUCCESS)
> return ret;
This is the third place which needs this workaround.
UBIFS, F2FS, and now iomap.
I agree with Dave that nobody can assume that PG_private implies an additional
page reference.
But page migration does that. Including parts of the write back code.
Thanks,
//richard
Powered by blists - more mailing lists