@@ -1754,23 +1754,23 @@ static void rcu_torture_fwd_prog_cond_resched(unsigned long iter)
1754
1754
* Free all callbacks on the rcu_fwd_cb_head list, either because the
1755
1755
* test is over or because we hit an OOM event.
1756
1756
*/
1757
- static unsigned long rcu_torture_fwd_prog_cbfree (void )
1757
+ static unsigned long rcu_torture_fwd_prog_cbfree (struct rcu_fwd * rfp )
1758
1758
{
1759
1759
unsigned long flags ;
1760
1760
unsigned long freed = 0 ;
1761
1761
struct rcu_fwd_cb * rfcp ;
1762
1762
1763
1763
for (;;) {
1764
- spin_lock_irqsave (& rcu_fwds . rcu_fwd_lock , flags );
1765
- rfcp = rcu_fwds . rcu_fwd_cb_head ;
1764
+ spin_lock_irqsave (& rfp -> rcu_fwd_lock , flags );
1765
+ rfcp = rfp -> rcu_fwd_cb_head ;
1766
1766
if (!rfcp ) {
1767
- spin_unlock_irqrestore (& rcu_fwds . rcu_fwd_lock , flags );
1767
+ spin_unlock_irqrestore (& rfp -> rcu_fwd_lock , flags );
1768
1768
break ;
1769
1769
}
1770
- rcu_fwds . rcu_fwd_cb_head = rfcp -> rfc_next ;
1771
- if (!rcu_fwds . rcu_fwd_cb_head )
1772
- rcu_fwds . rcu_fwd_cb_tail = & rcu_fwds . rcu_fwd_cb_head ;
1773
- spin_unlock_irqrestore (& rcu_fwds . rcu_fwd_lock , flags );
1770
+ rfp -> rcu_fwd_cb_head = rfcp -> rfc_next ;
1771
+ if (!rfp -> rcu_fwd_cb_head )
1772
+ rfp -> rcu_fwd_cb_tail = & rfp -> rcu_fwd_cb_head ;
1773
+ spin_unlock_irqrestore (& rfp -> rcu_fwd_lock , flags );
1774
1774
kfree (rfcp );
1775
1775
freed ++ ;
1776
1776
rcu_torture_fwd_prog_cond_resched (freed );
@@ -1926,7 +1926,7 @@ static void rcu_torture_fwd_prog_cr(struct rcu_fwd *rfp)
1926
1926
cver = READ_ONCE (rcu_torture_current_version ) - cver ;
1927
1927
gps = rcutorture_seq_diff (cur_ops -> get_gp_seq (), gps );
1928
1928
cur_ops -> cb_barrier (); /* Wait for callbacks to be invoked. */
1929
- (void )rcu_torture_fwd_prog_cbfree ();
1929
+ (void )rcu_torture_fwd_prog_cbfree (rfp );
1930
1930
1931
1931
if (!torture_must_stop () && !READ_ONCE (rcu_fwd_emergency_stop ) &&
1932
1932
!shutdown_time_arrived ()) {
@@ -1952,20 +1952,22 @@ static void rcu_torture_fwd_prog_cr(struct rcu_fwd *rfp)
1952
1952
static int rcutorture_oom_notify (struct notifier_block * self ,
1953
1953
unsigned long notused , void * nfreed )
1954
1954
{
1955
+ struct rcu_fwd * rfp = & rcu_fwds ;
1956
+
1955
1957
WARN (1 , "%s invoked upon OOM during forward-progress testing.\n" ,
1956
1958
__func__ );
1957
- rcu_torture_fwd_cb_hist (& rcu_fwds );
1958
- rcu_fwd_progress_check (1 + (jiffies - READ_ONCE (rcu_fwds . rcu_fwd_startat )) / 2 );
1959
+ rcu_torture_fwd_cb_hist (rfp );
1960
+ rcu_fwd_progress_check (1 + (jiffies - READ_ONCE (rfp -> rcu_fwd_startat )) / 2 );
1959
1961
WRITE_ONCE (rcu_fwd_emergency_stop , true);
1960
1962
smp_mb (); /* Emergency stop before free and wait to avoid hangs. */
1961
1963
pr_info ("%s: Freed %lu RCU callbacks.\n" ,
1962
- __func__ , rcu_torture_fwd_prog_cbfree ());
1964
+ __func__ , rcu_torture_fwd_prog_cbfree (rfp ));
1963
1965
rcu_barrier ();
1964
1966
pr_info ("%s: Freed %lu RCU callbacks.\n" ,
1965
- __func__ , rcu_torture_fwd_prog_cbfree ());
1967
+ __func__ , rcu_torture_fwd_prog_cbfree (rfp ));
1966
1968
rcu_barrier ();
1967
1969
pr_info ("%s: Freed %lu RCU callbacks.\n" ,
1968
- __func__ , rcu_torture_fwd_prog_cbfree ());
1970
+ __func__ , rcu_torture_fwd_prog_cbfree (rfp ));
1969
1971
smp_mb (); /* Frees before return to avoid redoing OOM. */
1970
1972
(* (unsigned long * )nfreed )++ ; /* Forward progress CBs freed! */
1971
1973
pr_info ("%s returning after OOM processing.\n" , __func__ );
@@ -2008,6 +2010,8 @@ static int rcu_torture_fwd_prog(void *args)
2008
2010
/* If forward-progress checking is requested and feasible, spawn the thread. */
2009
2011
static int __init rcu_torture_fwd_prog_init (void )
2010
2012
{
2013
+ struct rcu_fwd * rfp = & rcu_fwds ;
2014
+
2011
2015
if (!fwd_progress )
2012
2016
return 0 ; /* Not requested, so don't do it. */
2013
2017
if (!cur_ops -> stall_dur || cur_ops -> stall_dur () <= 0 ||
@@ -2022,14 +2026,13 @@ static int __init rcu_torture_fwd_prog_init(void)
2022
2026
WARN_ON (1 ); /* Make sure rcutorture notices conflict. */
2023
2027
return 0 ;
2024
2028
}
2025
- spin_lock_init (& rcu_fwds . rcu_fwd_lock );
2026
- rcu_fwds . rcu_fwd_cb_tail = & rcu_fwds . rcu_fwd_cb_head ;
2029
+ spin_lock_init (& rfp -> rcu_fwd_lock );
2030
+ rfp -> rcu_fwd_cb_tail = & rfp -> rcu_fwd_cb_head ;
2027
2031
if (fwd_progress_holdoff <= 0 )
2028
2032
fwd_progress_holdoff = 1 ;
2029
2033
if (fwd_progress_div <= 0 )
2030
2034
fwd_progress_div = 4 ;
2031
- return torture_create_kthread (rcu_torture_fwd_prog ,
2032
- & rcu_fwds , fwd_prog_task );
2035
+ return torture_create_kthread (rcu_torture_fwd_prog , rfp , fwd_prog_task );
2033
2036
}
2034
2037
2035
2038
/* Callback function for RCU barrier testing. */
0 commit comments