File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -492,6 +492,30 @@ rq_unlock_irqrestore(struct rq *rq, struct rq_flags *rf)
492
492
raw_spin_unlock_irqrestore (& rq -> lock , rf -> flags );
493
493
}
494
494
495
+ void raw_spin_rq_lock_nested (struct rq * rq , int subclass )
496
+ {
497
+ raw_spinlock_t * lock ;
498
+
499
+ /* Matches synchronize_rcu() in __sched_core_enable() */
500
+ preempt_disable ();
501
+
502
+ for (;;) {
503
+ lock = __rq_lockp (rq );
504
+ raw_spin_lock_nested (lock , subclass );
505
+ if (likely (lock == __rq_lockp (rq ))) {
506
+ /* preempt_count *MUST* be > 1 */
507
+ preempt_enable_no_resched ();
508
+ return ;
509
+ }
510
+ raw_spin_unlock (lock );
511
+ }
512
+ }
513
+
514
+ void raw_spin_rq_unlock (struct rq * rq )
515
+ {
516
+ raw_spin_unlock (rq_lockp (rq ));
517
+ }
518
+
495
519
/*
496
520
* RQ-clock updating methods:
497
521
*/
Original file line number Diff line number Diff line change @@ -443,6 +443,36 @@ this_rq_lock_irq(struct rq_flags *rf)
443
443
return rq ;
444
444
}
445
445
446
+ extern void raw_spin_rq_lock_nested (struct rq * rq , int subclass );
447
+ extern void raw_spin_rq_unlock (struct rq * rq );
448
+
449
+ static inline raw_spinlock_t * __rq_lockp (struct rq * rq )
450
+ {
451
+ return & rq -> lock ;
452
+ }
453
+
454
+ static inline raw_spinlock_t * rq_lockp (struct rq * rq )
455
+ {
456
+ return __rq_lockp (rq );
457
+ }
458
+
459
+ static inline void raw_spin_rq_lock (struct rq * rq )
460
+ {
461
+ raw_spin_rq_lock_nested (rq , 0 );
462
+ }
463
+
464
+ static inline void raw_spin_rq_lock_irq (struct rq * rq )
465
+ {
466
+ local_irq_disable ();
467
+ raw_spin_rq_lock (rq );
468
+ }
469
+
470
+ static inline void raw_spin_rq_unlock_irq (struct rq * rq )
471
+ {
472
+ raw_spin_rq_unlock (rq );
473
+ local_irq_enable ();
474
+ }
475
+
446
476
static inline int task_current (struct rq * rq , struct task_struct * p )
447
477
{
448
478
return rq -> curr == p ;
You can’t perform that action at this time.
0 commit comments