All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Gao Xiang <hsiangkao@aol.com>, Artem Bityutskiy <dedekind1@gmail.com>
Cc: zhangjun <openzhangj@gmail.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Darrick J . Wong" <darrick.wong@oracle.com>,
	hch@lst.de, bfoster@redhat.com,
	Dave Chinner <david@fromorbit.com>,
	akpm@linux-foundation.org, kirill.shutemov@linux.intel.com,
	mhocko@suse.com, n-horiguchi@ah.jp.nec.com,
	mgorman@techsingularity.net, aarcange@redhat.com,
	willy@infradead.org, linux@dominikbrodowski.net,
	linux-mm@kvack.org, Gao Xiang <gaoxiang25@huawei.com>
Subject: Re: [PATCH] fix page_count in ->iomap_migrate_page()
Date: Fri, 14 Dec 2018 14:35:38 +0100	[thread overview]
Message-ID: <5520068.cAKZ7BqcUI@blindfold> (raw)
In-Reply-To: <2b19b3c4-2bc4-15fa-15cc-27a13e5c7af1@aol.com>

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

  reply	other threads:[~2018-12-14 13:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14  5:56 [PATCH] fix page_count in ->iomap_migrate_page() zhangjun
2018-12-14 11:25 ` Richard Weinberger
2018-12-14 11:25   ` Richard Weinberger
2018-12-14 12:26   ` Gao Xiang
2018-12-14 13:35     ` Richard Weinberger [this message]
2018-12-14 13:55       ` Gao Xiang
2018-12-15 10:51   ` Christoph Hellwig
2018-12-15 11:17     ` Richard Weinberger
2018-12-15  4:26 ` Gao Xiang

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=5520068.cAKZ7BqcUI@blindfold \
    --to=richard@nod.at \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=dedekind1@gmail.com \
    --cc=gaoxiang25@huawei.com \
    --cc=hch@lst.de \
    --cc=hsiangkao@aol.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@dominikbrodowski.net \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=openzhangj@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /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.