[PATCH OLK-6.6] workqueue: Fix kabi broken of enum WORK_OFFQ_POOL_SHIFT

hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ID0EGV -------------------------------- Fix kabi broken of enum WORK_OFFQ_POOL_SHIFT Fixes: ff86423eddff ("workqueue: Implement disable/enable for (delayed) work items") Signed-off-by: Qi Xi <xiqi2@huawei.com> --- include/linux/workqueue.h | 11 ++++++----- kernel/workqueue.c | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 3f1c3e699266..50ff1d28fb31 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -72,15 +72,14 @@ enum { * data contains off-queue information when !WORK_STRUCT_PWQ. * * MSB - * [ pool ID ] [ disable depth ] [ OFFQ flags ] [ STRUCT flags ] - * 16 bits 1 bit 4 or 5 bits + * [ disable depth ] [ pool ID ] [ OFFQ flags ] [ STRUCT flags ] + * 16 bits 1 bit 4 or 5 bits */ WORK_OFFQ_FLAG_SHIFT = WORK_STRUCT_FLAG_BITS, WORK_OFFQ_CANCELING_BIT = WORK_OFFQ_FLAG_SHIFT, WORK_OFFQ_FLAG_END, WORK_OFFQ_FLAG_BITS = WORK_OFFQ_FLAG_END - WORK_OFFQ_FLAG_SHIFT, - WORK_OFFQ_DISABLE_SHIFT = WORK_OFFQ_FLAG_SHIFT + WORK_OFFQ_FLAG_BITS, WORK_OFFQ_DISABLE_BITS = 16, /* @@ -88,10 +87,12 @@ enum { * and the last pool it was on. Cap pool ID to 31 bits and use the * highest number to indicate that no pool is associated. */ - WORK_OFFQ_POOL_SHIFT = WORK_OFFQ_DISABLE_SHIFT + WORK_OFFQ_DISABLE_BITS, - WORK_OFFQ_LEFT = BITS_PER_LONG - WORK_OFFQ_POOL_SHIFT, + WORK_OFFQ_POOL_SHIFT = WORK_OFFQ_FLAG_SHIFT + WORK_OFFQ_FLAG_BITS, + WORK_OFFQ_LEFT = BITS_PER_LONG - WORK_OFFQ_POOL_SHIFT - WORK_OFFQ_DISABLE_BITS, WORK_OFFQ_POOL_BITS = WORK_OFFQ_LEFT <= 31 ? WORK_OFFQ_LEFT : 31, + WORK_OFFQ_DISABLE_SHIFT = WORK_OFFQ_POOL_SHIFT + WORK_OFFQ_POOL_BITS, + /* bit mask for work_busy() return values */ WORK_BUSY_PENDING = 1 << 0, WORK_BUSY_RUNNING = 1 << 1, diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 81615eb5562e..fe1afd7fad31 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -722,6 +722,11 @@ static struct pool_workqueue *get_work_pwq(struct work_struct *work) return NULL; } +static unsigned long shift_and_mask(unsigned long v, u32 shift, u32 bits) +{ + return (v >> shift) & ((1U << bits) - 1); +} + /** * get_work_pool - return the worker_pool a given work was associated with * @work: the work item of interest @@ -747,18 +752,13 @@ static struct worker_pool *get_work_pool(struct work_struct *work) if (data & WORK_STRUCT_PWQ) return work_struct_pwq(data)->pool; - pool_id = data >> WORK_OFFQ_POOL_SHIFT; + pool_id = shift_and_mask(data, WORK_OFFQ_POOL_SHIFT, WORK_OFFQ_POOL_BITS); if (pool_id == WORK_OFFQ_POOL_NONE) return NULL; return idr_find(&worker_pool_idr, pool_id); } -static unsigned long shift_and_mask(unsigned long v, u32 shift, u32 bits) -{ - return (v >> shift) & ((1U << bits) - 1); -} - static void work_offqd_unpack(struct work_offq_data *offqd, unsigned long data) { WARN_ON_ONCE(data & WORK_STRUCT_PWQ); -- CodeHub

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/18320 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/TW5... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/18320 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/TW5...
participants (2)
-
patchwork bot
-
Qi Xi