函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:lib\flex_proportions.c Create Date:2022-07-27 07:11:21
首页 Copyright©Brick

105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
static void fprop_reflect_period_single(struct fprop_global *p,
                    struct fprop_local_single *pl)
{
    unsigned int period = p->period;
    unsigned long flags;
 
    /* Fast path - period didn't change */
    if (pl->period == period)
        return;
    raw_spin_lock_irqsave(&pl->lock, flags);
    /* Someone updated pl->period while we were spinning? */
    if (pl->period >= period) {
        raw_spin_unlock_irqrestore(&pl->lock, flags);
        return;
    }
    /* Aging zeroed our fraction? */
    if (period - pl->period < BITS_PER_LONG)
        pl->events >>= period - pl->period;
    else
        pl->events = 0;
    pl->period = period;
    raw_spin_unlock_irqrestore(&pl->lock, flags);
}