From: Andrew Morton <akpm@linux-foundation.org>
To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Tejun Heo <tj@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Johannes Weiner <hannes@cmpxchg.org>,
linux-fsdevel@vger.kernel.org, Jan Kara <jack@suse.cz>
Subject: Re: [PATCH 1/2] mm/filemap: don't initiate writeback if mapping has no dirty pages
Date: Mon, 22 Jul 2019 17:52:30 -0700 [thread overview]
Message-ID: <20190722175230.d357d52c3e86dc87efbd4243@linux-foundation.org> (raw)
In-Reply-To: <156378816804.1087.8607636317907921438.stgit@buzz>
(cc linux-fsdevel and Jan)
On Mon, 22 Jul 2019 12:36:08 +0300 Konstantin Khlebnikov <khlebnikov@yandex-team.ru> wrote:
> Functions like filemap_write_and_wait_range() should do nothing if inode
> has no dirty pages or pages currently under writeback. But they anyway
> construct struct writeback_control and this does some atomic operations
> if CONFIG_CGROUP_WRITEBACK=y - on fast path it locks inode->i_lock and
> updates state of writeback ownership, on slow path might be more work.
> Current this path is safely avoided only when inode mapping has no pages.
>
> For example generic_file_read_iter() calls filemap_write_and_wait_range()
> at each O_DIRECT read - pretty hot path.
>
> This patch skips starting new writeback if mapping has no dirty tags set.
> If writeback is already in progress filemap_write_and_wait_range() will
> wait for it.
>
> ...
>
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -408,7 +408,8 @@ int __filemap_fdatawrite_range(struct address_space *mapping, loff_t start,
> .range_end = end,
> };
>
> - if (!mapping_cap_writeback_dirty(mapping))
> + if (!mapping_cap_writeback_dirty(mapping) ||
> + !mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
> return 0;
>
> wbc_attach_fdatawrite_inode(&wbc, mapping->host);
How does this play with tagged_writepages? We assume that no tagging
has been performed by any __filemap_fdatawrite_range() caller?
next prev parent reply other threads:[~2019-07-23 0:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-22 9:36 Konstantin Khlebnikov
2019-07-22 9:36 ` [PATCH 2/2] mm/filemap: rewrite mapping_needs_writeback in less fancy manner Konstantin Khlebnikov
2019-07-23 0:52 ` Andrew Morton [this message]
2019-07-23 8:16 ` [PATCH 1/2] mm/filemap: don't initiate writeback if mapping has no dirty pages Konstantin Khlebnikov
2019-07-30 14:14 ` Jan Kara
2019-07-30 14:57 ` Konstantin Khlebnikov
2019-07-30 15:48 ` Jan Kara
2019-07-30 18:15 ` Konstantin Khlebnikov
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=20190722175230.d357d52c3e86dc87efbd4243@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=hannes@cmpxchg.org \
--cc=jack@suse.cz \
--cc=khlebnikov@yandex-team.ru \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tj@kernel.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