bobijam,
+#ifndef HAVE_SHRINKER_COUNT
+static int osc_cache_shrink(SHRINKER_ARGS(sc, nr_to_scan, gfp_mask))
+{
+ struct shrink_control scv = {
+ .nr_to_scan = shrink_param(sc, nr_to_scan),
+ .gfp_mask = shrink_param(sc, gfp_mask)
+ };
+#if !defined(HAVE_SHRINKER_WANT_SHRINK_PTR) && !defined(HAVE_SHRINK_CONTROL)
+ struct shrinker *shrinker = NULL;
+#endif
+
+ (void)osc_cache_shrink_scan(shrinker, &scv);
+
+ return osc_cache_shrink_count(shrinker, &scv);
+}
+#endif
Is there any particular reason to return the value from osc_cache_shrink_count() instead of osc_cache_shrink_scan() itself?
kswapd0-43 [003] .... 2885.831749: mm_shrink_slab_start: osc_cache_shrink+0x0/0x60 [osc] ffff8800cd67c1c0: objects to shrink 56 gfp_flags GFP_KERNEL pgs_scanned 222 lru_pgs 665761 cache items 645137 delta 430 total_scan 486
kswapd0-43 [003] d... 2885.831751: r_osc_cache_shrink_scan_0: (osc_cache_shrink+0x36/0x60 [osc] <- osc_cache_shrink_scan) arg1=0x0
kswapd0-43 [003] d... 2885.831752: r_osc_cache_shrink_0: (shrink_slab+0x15c/0x340 <- osc_cache_shrink) arg1=0x9d811
kswapd0-43 [003] d... 2885.832371: r_osc_cache_shrink_scan_0: (osc_cache_shrink+0x36/0x60 [osc] <- osc_cache_shrink_scan) arg1=0x80
kswapd0-43 [003] d... 2885.832374: r_osc_cache_shrink_0: (shrink_slab+0x175/0x340 <- osc_cache_shrink) arg1=0x9d791
kswapd0-43 [003] d... 2885.832377: r_osc_cache_shrink_scan_0: (osc_cache_shrink+0x36/0x60 [osc] <- osc_cache_shrink_scan) arg1=0x0
kswapd0-43 [003] d... 2885.832378: r_osc_cache_shrink_0: (shrink_slab+0x15c/0x340 <- osc_cache_shrink) arg1=0x9d791
kswapd0-43 [003] d... 2885.833002: r_osc_cache_shrink_scan_0: (osc_cache_shrink+0x36/0x60 [osc] <- osc_cache_shrink_scan) arg1=0x80
kswapd0-43 [003] d... 2885.833004: r_osc_cache_shrink_0: (shrink_slab+0x175/0x340 <- osc_cache_shrink) arg1=0x9d711
kswapd0-43 [003] d... 2885.833008: r_osc_cache_shrink_scan_0: (osc_cache_shrink+0x36/0x60 [osc] <- osc_cache_shrink_scan) arg1=0x0
kswapd0-43 [003] d... 2885.833009: r_osc_cache_shrink_0: (shrink_slab+0x15c/0x340 <- osc_cache_shrink) arg1=0x9d711
kswapd0-43 [003] d... 2885.833569: r_osc_cache_shrink_scan_0: (osc_cache_shrink+0x36/0x60 [osc] <- osc_cache_shrink_scan) arg1=0x80
kswapd0-43 [003] d... 2885.833571: r_osc_cache_shrink_0: (shrink_slab+0x175/0x340 <- osc_cache_shrink) arg1=0x9d691
kswapd0-43 [003] .... 2885.833573: mm_shrink_slab_end: osc_cache_shrink+0x0/0x60 [osc] ffff8800cd67c1c0: unused scan count 56 new scan count 102 total_scan 46 last shrinker return val 644753
It seems like in such a scenario, vmscan requested 3 times to scan 128 objects, osc_cache_shrink_scan() reported 3 times that 128 objects were freed. However, the shrinker returned not 0x80;0x80;0x80, but 0x9d791; 0x9d711; 0x9d691, reported as "last shrinker return val 644753".
P.S. arg1 is $retval for osc_cache* retprobes.
bobijam,
Is there any particular reason to return the value from osc_cache_shrink_count() instead of osc_cache_shrink_scan() itself?
It seems like in such a scenario, vmscan requested 3 times to scan 128 objects, osc_cache_shrink_scan() reported 3 times that 128 objects were freed. However, the shrinker returned not 0x80;0x80;0x80, but 0x9d791; 0x9d711; 0x9d691, reported as "last shrinker return val 644753".
P.S. arg1 is $retval for osc_cache* retprobes.