RCU priority boosting that survives vicious testing
Subsystems (4)
cover RCU priority boosting that survives vicious testing
Hello!
This is yet another update of the RCU priority-boosting patch (see http://lkml.org/lkml/2007/1/24/294 for the previous version). This series contains the RCU-boost patch itself and rcutorture modifications to test it more thoroughly. This version incorporates feedback from Josh Triplett and applies cleanly to 2.6.20-rc6-rt6.
Thanx, Paul
RFC PATCH 1/2 RCU priority boosting that survives vicious testing
Here is the RCU priority-boosting patch. Pretty close to the
http://lkml.org/lkml/2007/1/24/295 version. This patch prevents preempted or blocked low-priority RCU readers from indefinitely stalling RCU grace periods.
---
include/linux/init_task.h | 12 + include/linux/rcupdate.h | 12 + include/linux/rcupreempt.h | 20 + include/linux/sched.h | 16 + init/main.c | 1 kernel/Kconfig.preempt | 32 ++ kernel/fork.c | 6 kernel/rcupreempt.c | 528 +++++++++++++++++++++++++++++++++++++++++++++ kernel/rtmutex.c | 7 kernel/sched.c | 5 10 files changed, 636 insertions(+), 3 deletions(-)
include/linux/init_task.h +12 -0
@@ -87,6 +87,17 @@ extern struct nsproxy init_nsproxy; .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \ } +#ifdef CONFIG_PREEMPT_RCU_BOOST +#define INIT_RCU_BOOST_PRIO .rcu_prio = MAX_PRIO, +#define INIT_PREEMPT_RCU_BOOST (tsk) \ + .rcub_rbdp = NULL, \ + .rcub_state = RCU_BOOST_IDLE, \ + .rcub_entry = LIST_HEAD_INIT(tsk.rcub_entry), +#else /* #ifdef CONFIG_PREEMPT_RCU_BOOST */ +#define INIT_RCU_BOOST_PRIO +#define INIT_PREEMPT_RCU_BOOST (tsk) +#endif /* #else #ifdef CONFIG_PREEMPT_RCU_BOOST */ +extern struct group_info init_groups;/*
@@ -143,6 +154,7 @@ extern struct group_info init_groups; .pi_lock = RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \INIT_TRACE_IRQFLAGS \ INIT_LOCKDEP \ +INIT_PREEMPT_RCU_BOOST (tsk) \ }
include/linux/rcupdate.h +12 -0
@@ -227,6 +227,18 @@ extern void rcu_barrier(void);extern void rcu_init (void );extern void rcu_advance_callbacks (int cpu,int user);extern void rcu_check_callbacks (int cpu,int user); +#ifdef CONFIG_PREEMPT_RCU_BOOST +extern void init_rcu_boost_late (void ); +extern void __rcu_preempt_boost (void ); +#define rcu_preempt_boost () \ + do { \ + if (unlikely(current->rcu_read_lock_nesting > 0)) \ + __rcu_preempt_boost(); \ + } while (0) +#else /* #ifdef CONFIG_PREEMPT_RCU_BOOST */ +#define init_rcu_boost_late () +#define rcu_preempt_boost () +#endif /* #else #ifdef CONFIG_PREEMPT_RCU_BOOST */ #endif /* __KERNEL__ */ #endif /* __LINUX_RCUPDATE_H */
include/linux/rcupreempt.h +20 -0
@@ -42,6 +42,26 @@#include <linux/cpumask.h> #include <linux/seqlock.h> +#ifdef CONFIG_PREEMPT_RCU_BOOST +/* +* Task state with respect to being RCU-boosted. This state is changed +* by the task itself in response to the following three events: +* 1. Preemption (or block on lock) while in RCU read-side critical section. +* 2. Outermost rcu_read_unlock() for blocked RCU read-side critical section. +* +* The RCU-boost task also updates the state when boosting priority. +*/ +enum rcu_boost_state { +RCU_BOOST_IDLE =0 ,/* Not yet blocked if in RCU read-side. */ +RCU_BOOST_BLOCKED =1 ,/* Blocked from RCU read-side. */ +RCU_BOOSTED =2 ,/* Boosting complete. */ +RCU_BOOST_INVALID =3 ,/* For bogus state sightings. */ +}; + +#define N_RCU_BOOST_STATE (RCU_BOOST_INVALID + 1) + +#endif /* #ifdef CONFIG_PREEMPT_RCU_BOOST */ +#define rcu_qsctr_inc (cpu)#define rcu_bh_qsctr_inc (cpu)#define call_rcu_bh (head, rcu) call_rcu(head, rcu)
include/linux/sched.h +16 -0
@@ -699,6 +699,14 @@ struct signal_struct {#define is_rt_policy (p) ((p) != SCHED_NORMAL && (p) != SCHED_BATCH)#define has_rt_policy (p) unlikely(is_rt_policy((p)->policy)) +#ifdef CONFIG_PREEMPT_RCU_BOOST +#define set_rcu_prio (p, prio) ((p)->rcu_prio = (prio)) +#define get_rcu_prio (p) ((p)->rcu_prio) +#else /* #ifdef CONFIG_PREEMPT_RCU_BOOST */ +#define set_rcu_prio (p, prio) do { } while (0) +#define get_rcu_prio (p) MAX_PRIO +#endif /* #else #ifdef CONFIG_PREEMPT_RCU_BOOST */ +/* * Some day this will be a full-fledged user tracking system.. */
@@ -982,6 +990,9 @@ struct task_struct {#endif int load_weight;/* for niceness load balancing purposes */ int prio, static_prio, normal_prio; +#ifdef CONFIG_PREEMPT_RCU_BOOST +int rcu_prio; +#endif /* #ifdef CONFIG_PREEMPT_RCU_BOOST */ struct list_head run_list;struct prio_array *array;
@@ -1003,6 +1014,11 @@ struct task_struct {atomic_t *rcu_flipctr1;atomic_t *rcu_flipctr2;#endif +#ifdef CONFIG_PREEMPT_RCU_BOOST +struct rcu_boost_dat *rcub_rbdp; +enum rcu_boost_state rcub_state; +struct list_head rcub_entry; +#endif /* #ifdef CONFIG_PREEMPT_RCU_BOOST */ #if defined(CONFIG_SCHEDSTATS ) || defined(CONFIG_TASK_DELAY_ACCT )struct sched_info sched_info;
init/main.c +1 -0
@@ -712,6 +712,7 @@ static void __init do_basic_setup(void)init_workqueues ();usermodehelper_init ();driver_init (); +init_rcu_boost_late ();#ifdef CONFIG_SYSCTL sysctl_init ();
kernel/Kconfig.preempt +32 -0
@@ -176,3 +176,35 @@ config RCU_TRACE Say Y here if you want to enable RCU tracing Say N if you are unsure. + +config PREEMPT_RCU_BOOST + bool "Enable priority boosting of RCU read-side critical sections" + depends on PREEMPT_RCU + default n + help + This option permits priority boosting of RCU read-side critical + sections that have been preempted in order to prevent indefinite + delay of grace periods in face of runaway non-realtime processes. + + Say N if you are unsure. + +config PREEMPT_RCU_BOOST_STATS + bool "Enable RCU priority-boosting statistic printing" + depends on PREEMPT_RCU_BOOST + default n + help + This option enables debug printk()s of RCU boost statistics, + which are normally only used to debug RCU priority boost + implementations. + + Say N if you are unsure. + +config PREEMPT_RCU_BOOST_STATS_INTERVAL + int "RCU priority-boosting statistic printing interval (seconds)" + depends on PREEMPT_RCU_BOOST_STATS + default 100 + range 10 86400 + help + This option controls the timing of debug printk()s of RCU boost + statistics, which are normally only used to debug RCU priority + boost implementations.
kernel/fork.c +6 -0
@@ -1129,6 +1129,12 @@ static struct task_struct *copy_process( p->softirq_context =0 ;#endif p->pagefault_disabled =0 ; +#ifdef CONFIG_PREEMPT_RCU_BOOST + p->rcu_prio =MAX_PRIO ; + p->rcub_rbdp =NULL ; + p->rcub_state =RCU_BOOST_IDLE ; +INIT_LIST_HEAD (&p->rcub_entry); +#endif #ifdef CONFIG_LOCKDEP p->lockdep_depth =0 ;/* no locks held yet */ p->curr_chain_key =0 ;
kernel/rcupreempt.c +528 -0
558 lines not on this page · raw message
kernel/rtmutex.c +4 -3
@@ -105,11 +105,12 @@ static inline void init_lists(struct rt_*/ int rt_mutex_getprio (struct task_struct *task) { +int prio =min (task->normal_prio,get_rcu_prio (task)); +if (likely (!task_has_pi_waiters (task))) -return task->normal_prio; +return prio; -return min (task_top_pi_waiter (task)->pi_list_entry.prio, - task->normal_prio); +return min (task_top_pi_waiter (task)->pi_list_entry.prio, prio); }/*
kernel/sched.c +5 -0
@@ -1962,6 +1962,7 @@ void fastcall sched_fork(struct task_str* Make sure we do not leak PI boosting priority to the child: */ p->prio = current->normal_prio; +set_rcu_prio (p,MAX_PRIO );INIT_LIST_HEAD (&p->run_list); p->array =NULL ;
@@ -2044,6 +2045,7 @@ void fastcall wake_up_new_task(struct taelse { p->prio = current->prio; p->normal_prio = current->normal_prio; +set_rcu_prio (p,MAX_PRIO );__activate_task_after (p, current, rq); }set_need_resched ();
@@ -3986,6 +3988,8 @@ void __sched __schedule(void) }profile_hit (SCHED_PROFILING ,__builtin_return_address (0 )); +rcu_preempt_boost (); +preempt_disable ();// FIXME: disable irqs here prev = current;release_kernel_lock (prev);
@@ -5725,6 +5729,7 @@ void __cpuinit init_idle(struct task_str idle->sleep_avg =0 ; idle->array =NULL ; idle->prio = idle->normal_prio =MAX_PRIO ; +set_rcu_prio (idle,MAX_PRIO ); idle->state =TASK_RUNNING ; idle->cpus_allowed =cpumask_of_cpu (cpu);set_task_cpu (idle, cpu);
Quoted 4 lines · Paul E. McKenney
Here is the RCU priority-boosting patch. Pretty close to the
http://lkml.org/lkml/2007/1/24/295 version. This patch prevents preempted or blocked low-priority RCU readers from indefinitely stalling RCU grace periods.
thanks - i've applied both patches to -rt and it's looking good so far! Find a small cosmetic fix below.
Ingo
kernel/rcupreempt.c +1 -1
@@ -489,7 +489,7 @@ void init_rcu_boost_late(void) rcu_boost_task =kthread_run (rcu_booster,NULL ,"RCU Prio Booster" );if (IS_ERR (rcu_boost_task)) {printk (KERN_ALERT -"Unable to create RCU Priority Booster, errno %d\n" , +"Unable to create RCU Priority Booster, errno %ld\n" , -PTR_ERR (rcu_boost_task));/*
Quoted 10 lines · Ingo Molnar
Quoted 4 lines · Paul E. McKenney
Here is the RCU priority-boosting patch. Pretty close to the
http://lkml.org/lkml/2007/1/24/295 version. This patch prevents preempted or blocked low-priority RCU readers from indefinitely stalling RCU grace periods.thanks - i've applied both patches to -rt and it's looking good so far! Find a small cosmetic fix below.
Sorry for the %d noise! :-/
I will send another patch addressing Nigel's freeze_processes() review comments.
Thanx, Paul
Quoted 15 lines
Ingo
Index:
linux/kernel/rcupreempt.c
===================================================================kernel/rcupreempt.c +1
-1@@ -489,7 +489,7 @@ void init_rcu_boost_late(void) rcu_boost_task =kthread_run (rcu_booster,NULL ,"RCU Prio Booster" );if (IS_ERR (rcu_boost_task)) {printk (KERN_ALERT -"Unable to create RCU Priority Booster, errno %d\n" , +"Unable to create RCU Priority Booster, errno %ld\n" , -PTR_ERR (rcu_boost_task));/*
RFC PATCH 2/2 RCU priority boosting additions to rcutorture
In reply to Paul E. McKenneyThis patch adds an optional preemption kernel thread to the rcutorture tests. This thread sets itself to a low RT priority and chews up CPU in 10-second bursts, verifying that grace periods progress during this 10-second interval. Passes RCU torture testing on a 4-CPU (a pair of 2-CPU dies) 64-bit Xeon system.
---
rcutorture.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 76 insertions(+), 14 deletions(-)
kernel/rcutorture.c +76 -14
@@ -58,6 +58,7 @@ static int stat_interval; /* Interval bestatic int verbose;/* Print more debug info. */ static int test_no_idle_hz;/* Test RCU's support for tickless idle CPUs. */ static int shuffle_interval =5 ;/* Interval between shuffles (in sec)*/ +static int preempt_torture =0 ;/* Realtime task preempts torture readers. */ static char *torture_type ="rcu" ;/* What RCU implementation to torture. */ module_param (nreaders, int,0 );
@@ -72,6 +73,8 @@ module_param(test_no_idle_hz, bool, 0);MODULE_PARM_DESC (test_no_idle_hz,"Test support for tickless idle CPUs" );module_param (shuffle_interval, int,0 );MODULE_PARM_DESC (shuffle_interval,"Number of seconds between shuffles" ); +module_param (preempt_torture, bool,0 ); +MODULE_PARM_DESC (preempt_torture,"Enable realtime preemption torture" );module_param (torture_type, charp,0 );MODULE_PARM_DESC (torture_type,"Type of RCU to torture (rcu, rcu_bh, srcu)" );
@@ -194,6 +197,8 @@ struct rcu_torture_ops {int (*completed)(void );void (*deferredfree)(struct rcu_torture *p);void (*sync)(void ); +long (*preemptstart)(void ); +void (*preemptend)(void );int (*stats)(char *page);char *name; };
@@ -258,16 +263,74 @@ static void rcu_torture_deferred_free(stcall_rcu (&p->rtort_rcu, rcu_torture_cb); } +static struct task_struct *rcu_preeempt_task; +static unsigned long rcu_torture_preempt_errors =0 ; + +static int rcu_torture_preempt (void *arg) +{ +int completedstart; +int err; +time_t gcstart; +struct sched_param sp; + + sp.sched_priority =MAX_RT_PRIO -1 ; + err =sched_setscheduler (current,SCHED_RR , &sp); +if (err !=0 ) +printk (KERN_ALERT "rcu_torture_preempt() priority err: %d\n" , + err); + current->flags |=PF_NOFREEZE ; + +do { + completedstart =rcu_torture_completed (); + gcstart = xtime.tv_sec; +while ((xtime.tv_sec - gcstart <10 ) && + (rcu_torture_completed () == completedstart)) +cond_resched (); +if (rcu_torture_completed () == completedstart) + rcu_torture_preempt_errors++; +schedule_timeout_interruptible (HZ ); + }while (!kthread_should_stop ()); +return 0 ; +} + +static long rcu_preempt_start (void ) +{ +long retval =0 ; + + rcu_preeempt_task =kthread_run (rcu_torture_preempt,NULL , +"rcu_torture_preempt" ); +if (IS_ERR (rcu_preeempt_task)) { +VERBOSE_PRINTK_ERRSTRING ("Failed to create preempter" ); + retval =PTR_ERR (rcu_preeempt_task); + rcu_preeempt_task =NULL ; + } +return retval; +} + +static void rcu_preempt_end (void ) +{ +if (rcu_preeempt_task !=NULL ) { +VERBOSE_PRINTK_STRING ("Stopping rcu_preempt task" ); +kthread_stop (rcu_preeempt_task); + } + rcu_preeempt_task =NULL ; +} + +static int rcu_preempt_stats (char *page) { +return sprintf (page, +"Preemption stalls: %lu\n" , rcu_torture_preempt_errors); +} +static struct rcu_torture_ops rcu_ops = { - .init =NULL , - .cleanup =NULL , .readlock = rcu_torture_read_lock, .readdelay = rcu_read_delay, .readunlock = rcu_torture_read_unlock, .completed = rcu_torture_completed, .deferredfree = rcu_torture_deferred_free, .sync = synchronize_rcu, - .stats =NULL , + .preemptstart = rcu_preempt_start, + .preemptend = rcu_preempt_end, + .stats = rcu_preempt_stats, .name ="rcu" };
@@ -299,14 +362,12 @@ static void rcu_sync_torture_init(void)static struct rcu_torture_ops rcu_sync_ops = { .init = rcu_sync_torture_init, - .cleanup =NULL , .readlock = rcu_torture_read_lock, .readdelay = rcu_read_delay, .readunlock = rcu_torture_read_unlock, .completed = rcu_torture_completed, .deferredfree = rcu_sync_torture_deferred_free, .sync = synchronize_rcu, - .stats =NULL , .name ="rcu_sync" };
@@ -362,28 +423,23 @@ static void rcu_bh_torture_synchronize(v }static struct rcu_torture_ops rcu_bh_ops = { - .init =NULL , - .cleanup =NULL , .readlock = rcu_bh_torture_read_lock, .readdelay = rcu_read_delay,/* just reuse rcu's version. */ .readunlock = rcu_bh_torture_read_unlock, .completed = rcu_bh_torture_completed, .deferredfree = rcu_bh_torture_deferred_free, .sync = rcu_bh_torture_synchronize, - .stats =NULL , .name ="rcu_bh" };static struct rcu_torture_ops rcu_bh_sync_ops = { .init = rcu_sync_torture_init, - .cleanup =NULL , .readlock = rcu_bh_torture_read_lock, .readdelay = rcu_read_delay,/* just reuse rcu's version. */ .readunlock = rcu_bh_torture_read_unlock, .completed = rcu_bh_torture_completed, .deferredfree = rcu_sync_torture_deferred_free, .sync = rcu_bh_torture_synchronize, - .stats =NULL , .name ="rcu_bh_sync" };
@@ -495,14 +551,12 @@ static void sched_torture_synchronize(vostatic struct rcu_torture_ops sched_ops = { .init = rcu_sync_torture_init, - .cleanup =NULL , .readlock = sched_torture_read_lock, .readdelay = rcu_read_delay,/* just reuse rcu's version. */ .readunlock = sched_torture_read_unlock, .completed = sched_torture_completed, .deferredfree = rcu_sync_torture_deferred_free, .sync = sched_torture_synchronize, - .stats =NULL , .name ="sched" };
@@ -801,9 +855,10 @@ rcu_torture_print_module_parms(char *tagprintk (KERN_ALERT "%s" TORTURE_FLAG "--- %s: nreaders=%d nfakewriters=%d " "stat_interval=%d verbose=%d test_no_idle_hz=%d " -"shuffle_interval = %d\n" , +"shuffle_interval=%d preempt_torture=%d\n" , torture_type, tag, nrealreaders, nfakewriters, - stat_interval, verbose, test_no_idle_hz, shuffle_interval); + stat_interval, verbose, test_no_idle_hz, shuffle_interval, + preempt_torture); } static void
@@ -856,6 +911,8 @@ rcu_torture_cleanup(void)kthread_stop (stats_task); } stats_task =NULL ; +if (preempt_torture && (cur_ops->preemptend !=NULL )) + cur_ops->preemptend ();/* Wait for all RCU callbacks to fire. */ rcu_barrier ();
@@ -997,6 +1054,11 @@ rcu_torture_init(void) goto unwind; } } +if (preempt_torture && (cur_ops->preemptstart !=NULL )) { + firsterr = cur_ops->preemptstart (); +if (firsterr !=0 ) + goto unwind; + }return 0 ; unwind:
Re: [RFC PATCH -rt 2/2] RCU priority boosting additions to rcutorture
Hi Paul.
Quoted 5 lines · Paul E. McKenney
This patch adds an optional preemption kernel thread to the rcutorture tests. This thread sets itself to a low RT priority and chews up CPU in 10-second bursts, verifying that grace periods progress during this 10-second interval. Passes RCU torture testing on a 4-CPU (a pair of 2-CPU dies) 64-bit Xeon system.
[...]
Quoted 17 lines
Signed-off-by Paul E. McKenney <[email protected]>kernel/rcutorture.c +16
-0+static int rcu_torture_preempt (void *arg) +{ +int completedstart; +int err; +time_t gcstart; +struct sched_param sp; + + sp.sched_priority =MAX_RT_PRIO -1 ; + err =sched_setscheduler (current,SCHED_RR , &sp); +if (err !=0 ) +printk (KERN_ALERT "rcu_torture_preempt() priority err: %d\n" , + err); + current->flags |=PF_NOFREEZE ; + + do { + completedstart = rcu_torture_completed();
kernel/rcutorture.c static void rcu_torture_deferred_free(st · line 294
Quoted 10 lines
kernel/rcutorture.c +10
-0+ gcstart = xtime.tv_sec; +while ((xtime.tv_sec - gcstart <10 ) && + (rcu_torture_completed () == completedstart)) +cond_resched (); +if (rcu_torture_completed () == completedstart) + rcu_torture_preempt_errors++; +schedule_timeout_interruptible (HZ ); + }while (!kthread_should_stop ()); +return 0 ; +}
Does it need to be NOFREEZE? I would think that it should be frozen during a suspend/hibernate.
Regards,
Nigel
Re: [RFC PATCH -rt 2/2] RCU priority boosting additions to rcutorture
Quoted 33 lines · Nigel Cunningham
Hi Paul.
Quoted 5 lines · Paul E. McKenney
This patch adds an optional preemption kernel thread to the rcutorture tests. This thread sets itself to a low RT priority and chews up CPU in 10-second bursts, verifying that grace periods progress during this 10-second interval. Passes RCU torture testing on a 4-CPU (a pair of 2-CPU dies) 64-bit Xeon system.
[...]
Quoted 22 lines
Signed-off-by Paul E. McKenney <[email protected]>kernel/rcutorture.c +21
-0+static int rcu_torture_preempt (void *arg) +{ +int completedstart; +int err; +time_t gcstart; +struct sched_param sp; + + sp.sched_priority =MAX_RT_PRIO -1 ; + err =sched_setscheduler (current,SCHED_RR , &sp); +if (err !=0 ) +printk (KERN_ALERT "rcu_torture_preempt() priority err: %d\n" , + err); + current->flags |=PF_NOFREEZE ; + + do { + completedstart = rcu_torture_completed(); + gcstart = xtime.tv_sec; + while ((xtime.tv_sec - gcstart < 10) && + (rcu_torture_completed() == completedstart)) + cond_resched(); + if (rcu_torture_completed() == completedstart)
Quoted 8 lines
kernel/rcutorture.c static void rcu_torture_deferred_free(st · line 294
Quoted 5 lines
kernel/rcutorture.c +5
-0+ rcu_torture_preempt_errors++; +schedule_timeout_interruptible (HZ ); + }while (!kthread_should_stop ()); +return 0 ; +}Does it need to be NOFREEZE? I would think that it should be frozen during a suspend/hibernate.
Good to hear from you, Nigel!
Should indeed be OK to freeze during suspend/hibernate. Will my schedule_timeout_interruptible() be sufficient to allow the freeze to happen, or do I need to add an explicit try_to_freeze()?
Ah, and I probably need to use the same trick that mtd_blktrans_thread() does to avoid having all my sleeps killed of by an errant signal:
spin_lock_irq(¤t->sighand->siglock); sigfillset(¤t->blocked); recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock);
Or is such paranoia unnecessary?
Thanx, Paul
Re: [RFC PATCH -rt 2/2] RCU priority boosting additions to rcutorture
Hi Paul.
Quoted 1 line · Paul E. McKenney
Good to hear from you, Nigel!
Thanks :)
Quoted 3 lines
Should indeed be OK to freeze during suspend/hibernate. Will my
schedule_timeout_interruptible()be sufficient to allow the freeze to happen, or do I need to add an explicittry_to_freeze()?
You need a try_to_freeze() - the process has to enter the refrigerator() function to be counted as frozen.
Quoted 9 lines
Ah, and I probably need to use the same trick that
mtd_blktrans_thread()does to avoid having all my sleeps killed of by an errant signal:spin_lock_irq(¤t->sighand->siglock); sigfillset(¤t->blocked); recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock);Or is such paranoia unnecessary?
Yeah. try_to_freeze() is a function now, so you can do something if (try_to_freeze()) goto sleep_again if you so desire.
Regards,
Nigel
Re: [RFC PATCH -rt 2/2] RCU priority boosting additions to rcutorture
Quoted 5 lines · Nigel Cunningham
Hi Paul.
Quoted 1 line · Paul E. McKenney
Good to hear from you, Nigel!
Quoted 8 lines
Thanks :)
Quoted 3 lines
Should indeed be OK to freeze during suspend/hibernate. Will my
schedule_timeout_interruptible()be sufficient to allow the freeze to happen, or do I need to add an explicittry_to_freeze()?You need a
try_to_freeze()- the process has to enter therefrigerator()function to be counted as frozen.
Even though it explicitly sleeps each time through the loop? Hmmm...
Quoted 8 lines
Quoted 8 lines
Ah, and I probably need to use the same trick that
mtd_blktrans_thread()does to avoid having all my sleeps killed of by an errant signal:spin_lock_irq(¤t->sighand->siglock); sigfillset(¤t->blocked); recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock);
Quoted 4 lines
Quoted 1 line
Or is such paranoia unnecessary?
Yeah.
try_to_freeze()is a function now, so you can do something if (try_to_freeze()) gotosleep_againif you so desire.
If try_to_freeze() succeeds, do I need to clean up signal state? It didn't look like it to me, but thought I should ask the expert!
My guess is that I can simply do:
try_to_freeze(); schedule_timeout_interruptible(HZ);
The schedule_timeout_interruptible() might return early, but if I don't care about getting a shorter than expected sleep, I am OK, right? Besides, one would have to get a couple of very closely spaced freeze_processes() calls for this to happen. ;-)
Thanx, Paul
Re: [RFC PATCH -rt 2/2] RCU priority boosting additions to rcutorture
Hi.
Quoted 8 lines · Paul E. McKenney
Quoted 7 lines · Nigel Cunningham
Hi Paul.
Quoted 1 line · Paul E. McKenney
Good to hear from you, Nigel!
Thanks :)
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Should indeed be OK to freeze during suspend/hibernate. Will my
schedule_timeout_interruptible()be sufficient to allow the freeze to happen, or do I need to add an explicittry_to_freeze()?You need a
try_to_freeze()- the process has to enter therefrigerator()function to be counted as frozen.Even though it explicitly sleeps each time through the loop? Hmmm...
Yes. Sleeping isn't enough - we have to be sure it won't wake up and perform work at inappropriate times (we don't know what process X might do if it did wake; the result could be an inconsistent image). It therefore needs to enter the refrigerator function so that the freezer code can ensure it remains inactive until the suspend-to-whatever cycle is complete.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Ah, and I probably need to use the same trick that
mtd_blktrans_thread()does to avoid having all my sleeps killed of by an errant signal:spin_lock_irq(¤t->sighand->siglock); sigfillset(¤t->blocked); recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock);
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Or is such paranoia unnecessary?
Yeah.
try_to_freeze()is a function now, so you can do something if (try_to_freeze()) gotosleep_againif you so desire.If
try_to_freeze()succeeds, do I need to clean up signal state? It didn't look like it to me, but thought I should ask the expert!
No, you don't need to. We have recalc_sigpending() in the refrigerator function.
Quoted 9 lines
My guess is that I can simply do:
try_to_freeze(); schedule_timeout_interruptible(HZ);The
schedule_timeout_interruptible()might return early, but if I don't care about getting a shorter than expected sleep, I am OK, right? Besides, one would have to get a couple of very closely spacedfreeze_processes()calls for this to happen. ;-)
Yes, that looks good to me.
Regards,
Nigel