Commit b37c4c83 authored by Darrick J. Wong's avatar Darrick J. Wong Committed by Dave Chinner
Browse files

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



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: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 03e0add8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1856,6 +1856,8 @@ xfs_inodegc_worker(
	struct xfs_inode	*ip, *n;
	unsigned int		nofs_flag;

	ASSERT(gc->cpu == smp_processor_id());

	WRITE_ONCE(gc->items, 0);

	if (!node)
+3 −0
Original line number Diff line number Diff line
@@ -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
};

/*
+3 −0
Original line number Diff line number Diff line
@@ -1095,6 +1095,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);