Skip to content

Commit b37c4c8

Browse files
Darrick J. WongDave Chinner
authored andcommitted
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: Darrick J. Wong <[email protected]> Reviewed-by: Dave Chinner <[email protected]> Signed-off-by: Dave Chinner <[email protected]>
1 parent 03e0add commit b37c4c8

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

fs/xfs/xfs_icache.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,6 +1856,8 @@ xfs_inodegc_worker(
18561856
struct xfs_inode *ip, *n;
18571857
unsigned int nofs_flag;
18581858

1859+
ASSERT(gc->cpu == smp_processor_id());
1860+
18591861
WRITE_ONCE(gc->items, 0);
18601862

18611863
if (!node)

fs/xfs/xfs_mount.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ struct xfs_inodegc {
6666
/* approximate count of inodes in the list */
6767
unsigned int items;
6868
unsigned int shrinker_hits;
69+
#if defined(DEBUG) || defined(XFS_WARN)
70+
unsigned int cpu;
71+
#endif
6972
};
7073

7174
/*

fs/xfs/xfs_super.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,9 @@ xfs_inodegc_init_percpu(
10951095

10961096
for_each_possible_cpu(cpu) {
10971097
gc = per_cpu_ptr(mp->m_inodegc, cpu);
1098+
#if defined(DEBUG) || defined(XFS_WARN)
1099+
gc->cpu = cpu;
1100+
#endif
10981101
init_llist_head(&gc->list);
10991102
gc->items = 0;
11001103
INIT_DELAYED_WORK(&gc->work, xfs_inodegc_worker);

0 commit comments

Comments
 (0)