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 3/8] fs: Basic infrastructure for offloading inode reclaim
Date: Wed, 25 Nov 2026 12:00:03 +0000 [thread overview]
Message-ID: <sashiko-outbox-233312@kernel.org> (raw)
In-Reply-To: <20261124115850.3512-11-jack@suse.cz>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] fs: queue_deferred_reclaim() fails to wake sibling workers on
small batches
--
commit 8c1021dc7fb5b82263bdc1a9f11c91562cd680a6
Author: Jan Kara <jack@suse.cz>
fs: Basic infrastructure for offloading inode reclaim
This commit adds infrastructure for marking inodes with I_DEFER_RECLAIM
and offloading their eviction from the superblock shrinker to a multi-worker
workqueue.
> diff --git a/fs/inode.c b/fs/inode.c
> index 4b13125f0678c..8853eb6015dc0 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
[ ... ]
> @@ -1017,6 +1036,38 @@ static enum lru_status inode_lru_isolate(struct list_head *item,
> return LRU_REMOVED;
> }
>
> +/* Number of inodes to process in one reclaim batch */
> +#define INODE_RECLAIM_BATCH_SIZE 16
> +
> +static int get_deferred_sb_id(struct super_block *sb)
> +{
> + return hash_ptr(sb, 32) % deferred_reclaim.workers;
> +}
> +
> +static void queue_deferred_reclaim(struct super_block *sb, int count,
> + struct list_head *list)
> +{
> + int id = get_deferred_sb_id(sb);
> + struct deferred_reclaim_queue *queue =
> + &deferred_reclaim.queues[id];
> + int i, wake_count;
> +
> + spin_lock(&queue->lock);
> + list_splice_tail(list, &queue->list);
> + atomic_add(count, &sb->s_deferred_reclaim_count);
> + spin_unlock(&queue->lock);
> +
> + /* Queue works to process inodes we've added to the list */
> + 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;
> + }
> +}
[Severity: Medium]
Can queue_deferred_reclaim() serialize deferred eviction for a superblock
onto a single worker when inodes are queued in batches of
INODE_RECLAIM_BATCH_SIZE (16) or fewer?
Because get_deferred_sb_id(sb) returns a fixed starting index for a given
superblock and wake_count is computed only from the current call's count,
any call with count <= 16 sets wake_count = 1 and only tries to queue
deferred_reclaim.work[id]. When multiple prune_icache_sb() scans (or
single-inode queuing from iput_final() in commit "fs: Defer reclaim of
unlinked inodes") each add <= 16 inodes while work[id] is busy and already
marked pending, queue_work() on work[id] returns false and the loop exits
without waking work[id + 1] or any of the other idle workers, even if a
large backlog has accumulated on queue->list.
Computing wake_count from the total queued count (or advancing to the next
worker when queue_work() returns false) would allow sibling workers to help
drain the queue via get_inode_reclaim_batch().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124115850.3512-9-jack@suse.cz?part=3
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 [this message]
2026-11-24 11:58 ` [PATCH v2 4/8] fs: Defer reclaim of unlinked inodes Jan Kara
2026-11-25 12:00 ` sashiko-bot
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-233312@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