aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.ibm.com>2018-10-03 15:33:41 -0400
committerPaul E. McKenney <paulmck@linux.ibm.com>2018-12-01 15:45:39 -0500
commit1a682754c7ed9df213069d5a0d3981f8360a32c2 (patch)
tree8ca0ecd94efc87b01bcfca25e3430201176aeb32
parent8dd3b54689d9a2103c0817f2b7adc51760a45551 (diff)
rcutorture: Print histogram of CB invocation at OOM time
One reason why a forward-progress test might fail would be if something prevented or delayed callback invocation. This commit therefore adds a callback-invocation histogram printout when OOM is reported to rcutorture. Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
-rw-r--r--kernel/rcu/rcutorture.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index f28b88ecb47a..329f4fb13125 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -1631,6 +1631,20 @@ static bool rcu_fwd_emergency_stop;
1631#define MIN_FWD_CBS_LAUNDERED 100 /* Number of counted CBs. */ 1631#define MIN_FWD_CBS_LAUNDERED 100 /* Number of counted CBs. */
1632static long n_launders_hist[2 * MAX_FWD_CB_JIFFIES / HZ]; 1632static long n_launders_hist[2 * MAX_FWD_CB_JIFFIES / HZ];
1633 1633
1634static void rcu_torture_fwd_cb_hist(void)
1635{
1636 int i;
1637 int j;
1638
1639 for (i = ARRAY_SIZE(n_launders_hist) - 1; i > 0; i--)
1640 if (n_launders_hist[i] > 0)
1641 break;
1642 pr_alert("%s: Callback-invocation histogram:", __func__);
1643 for (j = 0; j <= i; j++)
1644 pr_cont(" %ds: %ld", j + 1, n_launders_hist[j]);
1645 pr_cont("\n");
1646}
1647
1634/* Callback function for continuous-flood RCU callbacks. */ 1648/* Callback function for continuous-flood RCU callbacks. */
1635static void rcu_torture_fwd_cb_cr(struct rcu_head *rhp) 1649static void rcu_torture_fwd_cb_cr(struct rcu_head *rhp)
1636{ 1650{
@@ -1718,7 +1732,6 @@ static void rcu_torture_fwd_prog_cr(void)
1718 unsigned long cver; 1732 unsigned long cver;
1719 unsigned long gps; 1733 unsigned long gps;
1720 int i; 1734 int i;
1721 int j;
1722 long n_launders; 1735 long n_launders;
1723 long n_launders_cb_snap; 1736 long n_launders_cb_snap;
1724 long n_launders_sa; 1737 long n_launders_sa;
@@ -1791,13 +1804,7 @@ static void rcu_torture_fwd_prog_cr(void)
1791 n_launders + n_max_cbs - n_launders_cb_snap, 1804 n_launders + n_max_cbs - n_launders_cb_snap,
1792 n_launders, n_launders_sa, 1805 n_launders, n_launders_sa,
1793 n_max_gps, n_max_cbs, cver, gps); 1806 n_max_gps, n_max_cbs, cver, gps);
1794 for (i = ARRAY_SIZE(n_launders_hist) - 1; i > 0; i--) 1807 rcu_torture_fwd_cb_hist();
1795 if (n_launders_hist[i] > 0)
1796 break;
1797 pr_alert("Callback-invocation histogram:");
1798 for (j = 0; j <= i; j++)
1799 pr_cont(" %ds: %ld", j + 1, n_launders_hist[j]);
1800 pr_cont("\n");
1801 } 1808 }
1802} 1809}
1803 1810
@@ -1809,6 +1816,7 @@ static void rcu_torture_fwd_prog_cr(void)
1809static int rcutorture_oom_notify(struct notifier_block *self, 1816static int rcutorture_oom_notify(struct notifier_block *self,
1810 unsigned long notused, void *nfreed) 1817 unsigned long notused, void *nfreed)
1811{ 1818{
1819 rcu_torture_fwd_cb_hist();
1812 rcu_fwd_progress_check(1 + (jiffies - READ_ONCE(rcu_fwd_startat) / 2)); 1820 rcu_fwd_progress_check(1 + (jiffies - READ_ONCE(rcu_fwd_startat) / 2));
1813 WRITE_ONCE(rcu_fwd_emergency_stop, true); 1821 WRITE_ONCE(rcu_fwd_emergency_stop, true);
1814 return NOTIFY_OK; 1822 return NOTIFY_OK;