zoukankan      html  css  js  c++  java
  • raw_spin_lock_irqsave() flow

    raw_spin_lock_irqsave() flow

    include/linux/spinlock.h

    #define raw_spin_lock_irqsave(lock, flags)            
        do {                        
            typecheck(unsigned long, flags);    
            flags = _raw_spin_lock_irqsave(lock);    
        } while (0)

    static inline unsigned long __raw_spin_lock_irqsave(raw_spinlock_t *lock)

    static inline void
    do_raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long *flags) __acquires(lock)
    {
        __acquire(lock);
        arch_spin_lock_flags(&lock->raw_lock, *flags);
    }

    上面raw_lock是:

    arch_spinlock_t raw_lock;

    arch_spinlock_t为qspinlock:

    typedef struct qspinlock {
        union {
            atomic_t val;
    
            /*
             * By using the whole 2nd least significant byte for the
             * pending bit, we can allow better optimization of the lock
             * acquisition for the pending bit holder.
             */
    #ifdef __LITTLE_ENDIAN
            struct {
                u8    locked;
                u8    pending;
            };
            struct {
                u16    locked_pending;
                u16    tail;
            };
    #else
            struct {
                u16    tail;
                u16    locked_pending;
            };
            struct {
                u8    reserved[2];
                u8    pending;
                u8    locked;
            };
    #endif
        };
    } arch_spinlock_t;

    上面arch_spin_lock_flags define为arch_spin_lock(),这个define在qspinlock.h

    #ifndef arch_spin_lock_flags
    #define arch_spin_lock_flags(lock, flags)    arch_spin_lock(lock)
    #endif

    4.19includeasm-genericQspinlock.h

    #define arch_spin_lock(l)        queued_spin_lock(l)
  • 相关阅读:
    windows 动态库的封装以及调用
    ffmpeg 转码命令与ffplay
    YUV格式与RGB格式
    Qt QTimer
    Qt QLineEdit
    Qt setStyleSheet
    python查询
    INSERT INTO .. ON DUPLICATE KEY更新多行记录
    PHP读取流文件
    curl上传、下载、https登陆
  • 原文地址:https://www.cnblogs.com/aspirs/p/15356740.html
Copyright © 2011-2022 走看看