• T
    workqueue: introduce WORK_OFFQ_FLAG_* · b5490077
    Tejun Heo 提交于
    Low WORK_STRUCT_FLAG_BITS bits of work_struct->data contain
    WORK_STRUCT_FLAG_* and flush color.  If the work item is queued, the
    rest point to the cpu_workqueue with WORK_STRUCT_CWQ set; otherwise,
    WORK_STRUCT_CWQ is clear and the bits contain the last CPU number -
    either a real CPU number or one of WORK_CPU_*.
    
    Scheduled addition of mod_delayed_work[_on]() requires an additional
    flag, which is used only while a work item is off queue.  There are
    more than enough bits to represent off-queue CPU number on both 32 and
    64bits.  This patch introduces WORK_OFFQ_FLAG_* which occupy the lower
    part of the @work->data high bits while off queue.  This patch doesn't
    define any actual OFFQ flag yet.
    
    Off-queue CPU number is now shifted by WORK_OFFQ_CPU_SHIFT, which adds
    the number of bits used by OFFQ flags to WORK_STRUCT_FLAG_SHIFT, to
    make room for OFFQ flags.
    
    To avoid shift width warning with large WORK_OFFQ_FLAG_BITS, ulong
    cast is added to WORK_STRUCT_NO_CPU and, just in case, BUILD_BUG_ON()
    to check that there are enough bits to accomodate off-queue CPU number
    is added.
    
    This patch doesn't make any functional difference.
    Signed-off-by: NTejun Heo <tj@kernel.org>
    b5490077
workqueue.h 14.5 KB