From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: 天狼 <rockeet@gmail.com>
Cc: "David Hildenbrand (Arm)" <david@kernel.org>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Jann Horn <jannh@google.com>,
Matthew Wilcox <willy@infradead.org>, Jan Kara <jack@suse.cz>
Subject: Re: [RFC] madvise: best-effort deferred writeback for shared file mappings
Date: Wed, 30 Sep 2026 15:24:53 +0100 [thread overview]
Message-ID: <ar0a9y2E0nDTIC8V@gremlin> (raw)
In-Reply-To: <CAAE3jtcanTUrV3xfofwrvYGCFe5o=Vn7gS66bDzuxzeGg6c5=Q@mail.gmail.com>
On Wed, Sep 30, 2026 at 10:14:27PM +0800, 天狼 wrote:
> Hi David, Lorenzo,
>
> We currently work around this issue by setting the global
> vm.dirty_expire_centisecs to 60000.
>
> We have also developed a kernel module as another option. It exposes an
> ioctl that takes a file descriptor. For an already-dirty inode, it updates
> dirtied_when to the current jiffies and moves the inode to the newest end
> of the writeback dirty list, postponing its selection by periodic
> writeback. It leaves the dirty state intact and does not remove an inode
> from an already-queued flush.
>
> To keep postponing periodic writeback, the application must call this
> ioctl continuously at intervals shorter than vm.dirty_expire_centisecs,
> expressed in centiseconds. Once the calls stop, the normal expiration
> interval applies from the last call.
>
> The key code, with checks and locking omitted, is:
>
> inode->dirtied_when = jiffies;
> if (!(inode->i_state & I_SYNC_QUEUED))
> list_move(&inode->i_io_list, &wb->b_dirty);
>
Yeah that's absolutely violating how writeback is supposed to work.
> However, neither changing a global setting nor maintaining a separate
> kernel module is as elegant as having this supported directly in the
> kernel.
You're neglecting the question David and I have both raised with you here, which
is why you can't simply use shmem (e.g. a memfd) to achieve what you want to do
here?
Writing to a MAP_SHARED mapping is not recommended for a number of reasons, and
most software that does something like what you're doing uses shmem to achieve
it.
Overall I don't think there's a sensible kernel solution to your problem.
I strongly recommend you look at a shmem solution.
--
Cheers, Lorenzo
next prev parent reply other threads:[~2026-09-30 14:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 7:07 [RFC] madvise: best-effort deferred writeback for shared file mappings 天狼
2026-09-28 11:29 ` David Hildenbrand (Arm)
2026-09-28 13:09 ` 天狼
2026-09-28 19:12 ` David Hildenbrand (Arm)
2026-09-29 4:06 ` 天狼
2026-09-29 6:59 ` David Hildenbrand (Arm)
2026-09-29 8:59 ` Lorenzo Stoakes (ARM)
2026-09-30 10:27 ` 天狼
2026-09-30 11:38 ` David Hildenbrand (Arm)
2026-09-30 12:08 ` Lorenzo Stoakes (ARM)
2026-09-30 12:11 ` Lorenzo Stoakes (ARM)
2026-09-30 14:14 ` 天狼
2026-09-30 14:24 ` Lorenzo Stoakes (ARM) [this message]
2026-09-30 15:33 ` Lorenzo Stoakes (ARM)
2026-09-30 15:29 ` 天狼
2026-09-30 15:43 ` Lorenzo Stoakes (ARM)
2026-09-30 16:38 ` Jan Kara
2026-10-01 4:28 ` 天狼
2026-10-01 8:35 ` Lorenzo Stoakes (ARM)
2026-10-01 13:21 ` 天狼
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=ar0a9y2E0nDTIC8V@gremlin \
--to=ljs@kernel.org \
--cc=david@kernel.org \
--cc=jack@suse.cz \
--cc=jannh@google.com \
--cc=liam@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rockeet@gmail.com \
--cc=vbabka@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox