Lines Matching refs:rtsp

583 static bool (*rts_acquire)(struct refscale_typesafe *rtsp, unsigned int *start);
584 static bool (*rts_release)(struct refscale_typesafe *rtsp, unsigned int start);
587 static bool typesafe_ref_acquire(struct refscale_typesafe *rtsp, unsigned int *start) in typesafe_ref_acquire() argument
589 return atomic_inc_not_zero(&rtsp->rts_refctr); in typesafe_ref_acquire()
593 static bool typesafe_ref_release(struct refscale_typesafe *rtsp, unsigned int start) in typesafe_ref_release() argument
595 if (!atomic_dec_return(&rtsp->rts_refctr)) { in typesafe_ref_release()
596 WRITE_ONCE(rtsp->a, rtsp->a + 1); in typesafe_ref_release()
597 kmem_cache_free(typesafe_kmem_cachep, rtsp); in typesafe_ref_release()
603 static bool typesafe_lock_acquire(struct refscale_typesafe *rtsp, unsigned int *start) in typesafe_lock_acquire() argument
605 spin_lock(&rtsp->rts_lock); in typesafe_lock_acquire()
610 static bool typesafe_lock_release(struct refscale_typesafe *rtsp, unsigned int start) in typesafe_lock_release() argument
612 spin_unlock(&rtsp->rts_lock); in typesafe_lock_release()
617 static bool typesafe_seqlock_acquire(struct refscale_typesafe *rtsp, unsigned int *start) in typesafe_seqlock_acquire() argument
619 *start = read_seqbegin(&rtsp->rts_seqlock); in typesafe_seqlock_acquire()
625 static bool typesafe_seqlock_release(struct refscale_typesafe *rtsp, unsigned int start) in typesafe_seqlock_release() argument
627 return !read_seqretry(&rtsp->rts_seqlock, start); in typesafe_seqlock_release()
639 struct refscale_typesafe *rtsp; in typesafe_delay_section() local
648 rtsp = rcu_dereference(rtsarray[idx]); in typesafe_delay_section()
649 a = READ_ONCE(rtsp->a); in typesafe_delay_section()
650 if (!rts_acquire(rtsp, &start)) { in typesafe_delay_section()
654 if (a != READ_ONCE(rtsp->a)) { in typesafe_delay_section()
655 (void)rts_release(rtsp, start); in typesafe_delay_section()
660 b = READ_ONCE(rtsp->a); in typesafe_delay_section()
662 if (!rts_release(rtsp, start)) { in typesafe_delay_section()
667 b = rtsp->b; in typesafe_delay_section()
685 struct refscale_typesafe *rtsp; in typesafe_alloc_one() local
687 rtsp = kmem_cache_alloc(typesafe_kmem_cachep, GFP_KERNEL); in typesafe_alloc_one()
688 if (!rtsp) in typesafe_alloc_one()
690 atomic_set(&rtsp->rts_refctr, 1); in typesafe_alloc_one()
691 WRITE_ONCE(rtsp->a, rtsp->a + 1); in typesafe_alloc_one()
692 WRITE_ONCE(rtsp->b, rtsp->a * rtsp->a); in typesafe_alloc_one()
693 return rtsp; in typesafe_alloc_one()
700 struct refscale_typesafe *rtsp = rtsp_in; in refscale_typesafe_ctor() local
702 spin_lock_init(&rtsp->rts_lock); in refscale_typesafe_ctor()
703 seqlock_init(&rtsp->rts_seqlock); in refscale_typesafe_ctor()
705 rtsp->a = torture_random(this_cpu_ptr(&refscale_rand)); in refscale_typesafe_ctor()