xfs: check that per-cpu inodegc workers actually run on that cpu

[ Upstream commit b37c4c8339 ]

Now that we've allegedly worked out the problem of the per-cpu inodegc
workers being scheduled on the wrong cpu, let's put in a debugging knob
to let us know if a worker ever gets mis-scheduled again.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Darrick J. Wong 2023-09-21 18:01:54 -07:00 коммит произвёл Greg Kroah-Hartman
Родитель 67db9ecb84
Коммит 8444467ead
3 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -1856,6 +1856,8 @@ xfs_inodegc_worker(
struct llist_node *node = llist_del_all(&gc->list);
struct xfs_inode *ip, *n;
ASSERT(gc->cpu == smp_processor_id());
WRITE_ONCE(gc->items, 0);
if (!node)

Просмотреть файл

@ -66,6 +66,9 @@ struct xfs_inodegc {
/* approximate count of inodes in the list */
unsigned int items;
unsigned int shrinker_hits;
#if defined(DEBUG) || defined(XFS_WARN)
unsigned int cpu;
#endif
};
/*

Просмотреть файл

@ -1062,6 +1062,9 @@ xfs_inodegc_init_percpu(
for_each_possible_cpu(cpu) {
gc = per_cpu_ptr(mp->m_inodegc, cpu);
#if defined(DEBUG) || defined(XFS_WARN)
gc->cpu = cpu;
#endif
init_llist_head(&gc->list);
gc->items = 0;
INIT_DELAYED_WORK(&gc->work, xfs_inodegc_worker);