When you read this debugfs file it's isn't guaranteed the count
will happen before the scan, but I think the intent is that it does.
printf argument evaluation order is undefined.
Cc: Christian Koenig <christian.koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://lore.kernel.org/r/20250603220901.1217161-1-airlied@gmail.com
.gfp_mask = GFP_NOFS,
.nr_to_scan = TTM_SHRINKER_BATCH,
};
+ unsigned long count;
fs_reclaim_acquire(GFP_KERNEL);
- seq_printf(m, "%lu/%lu\n", ttm_pool_shrinker_count(mm_shrinker, &sc),
+ count = ttm_pool_shrinker_count(mm_shrinker, &sc);
+ seq_printf(m, "%lu/%lu\n", count,
ttm_pool_shrinker_scan(mm_shrinker, &sc));
fs_reclaim_release(GFP_KERNEL);