From: sashiko-bot@kernel.org
To: "Jan Kara" <jack@suse.cz>, "Christian Brauner" <brauner@kernel.org>
Cc: "Christoph Hellwig" <hch@infradead.org>,
linux-mm@kvack.org, "Mikhail Rudenko" <xyzzy@yandex-team.ru>,
"Andreas Gruenbacher" <agruenba@redhat.com>
Subject: Re: [PATCH v2 4/8] fs: Defer reclaim of unlinked inodes
Date: Wed, 25 Nov 2026 12:00:05 +0000 [thread overview]
Message-ID: <sashiko-outbox-233313@kernel.org> (raw)
In-Reply-To: <20261124115850.3512-12-jack@suse.cz>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] fs: single-worker serialization in iput_final() via
queue_deferred_reclaim()
--
commit 8449483727b2bbcd575fed1bb97c8ea7882097a9
Author: Jan Kara <jack@suse.cz>
fs: Defer reclaim of unlinked inodes
This commit offloads the eviction of unlinked inodes to the deferred reclaim
workqueue when the last reference is dropped from a memory reclaim context.
> diff --git a/fs/inode.c b/fs/inode.c
> index 8853eb6015dc0..2977d5f1382b9 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -2240,6 +2240,23 @@ static void iput_final(struct inode *inode)
> inode_lru_list_del(inode);
> spin_unlock(&inode->i_lock);
>
> + /*
> + * Are we going to delete this inode while in reclaim path? Likely
> + * reclaim of some object (e.g. overlayfs inode) ended up dropping the
> + * last reference to an already deleted inode. Offload the eviction as
> + * it's likely to require memory allocations and block on IO. Since
> + * this eviction was triggered by a reclaim of unrelated object, the
> + * inode is already outliving the operation that originally deleted it
> + * (unlink, file close...). A slightly longer delay thus should not be
> + * observable by userspace.
> + */
> + if (current->flags & PF_MEMALLOC && !inode->i_nlink) {
> + LIST_HEAD(defer);
> +
> + list_add(&inode->i_lru, &defer);
> + queue_deferred_reclaim(sb, 1, &defer);
> + return;
> + }
[Severity: Medium]
Does passing count = 1 to queue_deferred_reclaim() here serialize all
deferred unlinked inode evictions for a superblock onto a single worker?
queue_deferred_reclaim() starts at id = get_deferred_sb_id(sb) and computes
how many workers to wake from the per-call count rather than the total queued
inodes:
fs/inode.c:queue_deferred_reclaim() {
...
wake_count = DIV_ROUND_UP(count, INODE_RECLAIM_BATCH_SIZE);
if (wake_count > deferred_reclaim.workers)
wake_count = deferred_reclaim.workers;
for (i = 0; i < wake_count; i++) {
queue_work(deferred_reclaim.wq,
&deferred_reclaim.work[id]);
id = (id + 1) % deferred_reclaim.workers;
}
}
Because iput_final() queues one inode at a time, wake_count is always 1 and
only deferred_reclaim.work[id] for that superblock's hash id is ever queued.
When reclaim (such as overlayfs dcache/icache shrinking) drops the last
reference to many unlinked upper inodes, the remaining workers in
deferred_reclaim.work are never woken, throttling background inode deletion to
one thread.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124115850.3512-9-jack@suse.cz?part=4
next prev parent reply other threads:[~2026-11-25 12:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 11:58 [PATCH 0/8 v4] fs: Deferred inode reclaim Jan Kara
2026-11-24 11:58 ` [PATCH v2 1/8] writeback: Fix missed lazytime flush Jan Kara
2026-11-24 11:58 ` [PATCH v2 2/8] fs: Avoid inode dirtying on last iput Jan Kara
2026-11-25 12:00 ` sashiko-bot
2026-11-24 11:58 ` [PATCH v2 3/8] fs: Basic infrastructure for offloading inode reclaim Jan Kara
2026-11-25 12:00 ` sashiko-bot
2026-11-24 11:58 ` [PATCH v2 4/8] fs: Defer reclaim of unlinked inodes Jan Kara
2026-11-25 12:00 ` sashiko-bot [this message]
2026-11-24 11:58 ` [PATCH v2 5/8] fs: Defer reclaim of inodes requiring metadata writeback Jan Kara
2026-11-24 11:58 ` [PATCH v2 6/8] fs: Add throttling to deferred inode reclaim Jan Kara
2026-11-25 12:00 ` sashiko-bot
2026-11-24 11:58 ` [PATCH v2 7/8] fs: Protect deferred inode reclaim from freezing Jan Kara
2026-11-25 12:00 ` sashiko-bot
2026-11-24 11:58 ` [PATCH v2 8/8] ext4: Defer inode reclaim if it has preallocations Jan Kara
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=sashiko-outbox-233313@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agruenba@redhat.com \
--cc=brauner@kernel.org \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-mm@kvack.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=xyzzy@yandex-team.ru \
/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