[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5520068.cAKZ7BqcUI@blindfold>
Date: Fri, 14 Dec 2018 14:35:38 +0100
From: Richard Weinberger <richard@....at>
To: Gao Xiang <hsiangkao@....com>,
Artem Bityutskiy <dedekind1@...il.com>
Cc: zhangjun <openzhangj@...il.com>,
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, 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()
Am Freitag, 14. Dezember 2018, 13:26:28 CET schrieb Gao Xiang:
> Hi Richard,
>
> On 2018/12/14 19:25, Richard Weinberger wrote:
> > 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.
>
> It seems that it's clearly documented in
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/mm.h#n780
>
> * A pagecache page contains an opaque `private' member, which belongs to the
> * page's address_space. Usually, this is the address of a circular list of
> * the page's disk buffers. PG_private must be set to tell the VM to call
> * into the filesystem to release these pages.
> *
> * A page may belong to an inode's memory mapping. In this case, page->mapping
> * is the pointer to the inode, and page->index is the file offset of the page,
> * in units of PAGE_SIZE.
> *
> * If pagecache pages are not associated with an inode, they are said to be
> * anonymous pages. These may become associated with the swapcache, and in that
> * case PG_swapcache is set, and page->private is an offset into the swapcache.
> *
> * In either case (swapcache or inode backed), the pagecache itself holds one
> * reference to the page. Setting PG_private should also increment the
> * refcount. The each user mapping also has a reference to the page.
>
> and when I looked into that, I found
> https://lore.kernel.org/lkml/3CB3CA93.D141680B@zip.com.au/
Hmm, in case of UBIFS it seems easy. We can add a get/put_page() around setting/clearing
the flag.
I did that now and so far none of my tests exploded.
Artem, do you remember why UBIFS never raised the page counter when setting PG_private?
Thanks,
//richard
Powered by blists - more mailing lists