lkml.org 
[lkml]   [2019]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] mm/filemap: don't initiate writeback if mapping has no dirty pages

(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?

\
 
 \ /
  Last update: 2019-07-23 02:53    [W:0.061 / U:30.508 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site