From: Hugh Dickins <hughd@google.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org, Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH 2/5] shmemfs: Use redirty_page_for_writepage()
Date: Wed, 5 Mar 2014 20:06:23 -0800 (PST) [thread overview]
Message-ID: <alpine.LSU.2.11.1403051914570.1529@eggly.anvils> (raw)
In-Reply-To: <1394019878-25979-3-git-send-email-chris@chris-wilson.co.uk>
On Wed, 5 Mar 2014, Chris Wilson wrote:
> "When we cannot write a page we should use redirty_page_for_writepage()
> instead of plain set_page_dirty(). That tells writeback code we have
> problems, redirties only the page (redirtying buffers is not needed),
> and updates mm accounting of failed page writes."
I didn't locate the origin of that quotation, but it's talking about
the usual filesystem cap_account_dirty/cap_account_writeback protocol.
shmem doesn't participate it that: it only writes out (to swap) under
memory pressure, not for sync, and follows a much simpler path. Using
redirty_page_for_writepage() would lead it into complications, some of
which we prefer to avoid for efficiency, some of which would actually
be wrong (unless/until there's reason to convert shmem over to the
full protocol).
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Hugh Dickins <hughd@google.com>
So NAK.
But you didn't explain why you want to make this change. I presume
it's for the 5/5 which you didn't Cc to me, but I've looked up on
lists.freedesktop.org/archives/intel-gfx.
That's a bigger change and worrying: I've not thought through
the consequences of shmem page writeback from generic_writepages()
called from within a slab shrinker: we're used to doing shmem page
writeback from pageout() in mm/vmscan.c and nowhere else.
One thing that would certainly be wrong (liable to deadlock) would
be to do that when shrink_control's gfp_mask does not have __GFP_IO.
But I'm not comfortable with page writeback from this level at all.
The shmem_truncate_range() (you've had for a long time) should be safe,
and the new invalidate_mapping_pages() too: neither of those gets into
I/O, and invalidate_mapping_pages() looks as if it does all that's
necessary for those pages to be put under writeback at the next
shrink_inactive_list() of the lruvec.
Or perhaps there's a gotcha or two, which we can fix up.
But please try to stick to truncation and invalidation.
Hugh
> ---
> mm/shmem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 142b0bc085e1..18aa88eff8e3 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -872,7 +872,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
> mutex_unlock(&shmem_swaplist_mutex);
> swapcache_free(swap, NULL);
> redirty:
> - set_page_dirty(page);
> + redirty_page_for_writepage(wbc, page);
> if (wbc->for_reclaim)
> return AOP_WRITEPAGE_ACTIVATE; /* Return with page locked */
> unlock_page(page);
> --
> 1.9.0
next prev parent reply other threads:[~2014-03-06 4:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-05 11:44 Shrinker improvements Chris Wilson
2014-03-05 11:44 ` [PATCH 1/5] shmemfs: Report ENOMEM for page allocation failures outside of tmpfs faults Chris Wilson
2014-03-06 3:14 ` Hugh Dickins
2014-03-06 9:05 ` Chris Wilson
2014-03-11 10:09 ` Hugh Dickins
2014-03-05 11:44 ` [PATCH 2/5] shmemfs: Use redirty_page_for_writepage() Chris Wilson
2014-03-06 4:06 ` Hugh Dickins [this message]
2014-03-06 8:57 ` Chris Wilson
2014-03-05 11:44 ` [PATCH 3/5] drm/i915: Include bound and active pages in the count of shrinkable objects Chris Wilson
2014-03-05 11:44 ` [PATCH 4/5] drm/i915: Refactor common lock handling between shrinker count/scan Chris Wilson
2014-03-05 11:44 ` [PATCH 5/5] drm/i915: Writeback our pages under memory pressure Chris Wilson
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=alpine.LSU.2.11.1403051914570.1529@eggly.anvils \
--to=hughd@google.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox