hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IAGRKP CVE: NA
--------------------------------
blk_plug is always used with current, hence add the new filed into task_struct to fix kabi broken.
Signed-off-by: Yu Kuai yukuai3@huawei.com --- block/blk-core.c | 4 ++-- block/blk.h | 11 ++++++----- include/linux/blkdev.h | 3 +-- include/linux/sched.h | 1 + 4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c index 47b37c2fa073..caf3a897739e 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -3919,11 +3919,11 @@ void blk_start_plug(struct blk_plug *plug) INIT_LIST_HEAD(&plug->list); INIT_LIST_HEAD(&plug->mq_list); INIT_LIST_HEAD(&plug->cb_list); - plug->cur_ktime = 0; /* * Store ordering should not be needed here, since a potential * preempt will imply a full memory barrier */ + tsk->_resvd->cur_ktime = 0; tsk->plug = plug; } EXPORT_SYMBOL(blk_start_plug); @@ -4062,7 +4062,7 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule) if (q) queue_unplugged(q, depth, from_schedule);
- plug->cur_ktime = 0; + current->_resvd->cur_ktime = 0; current->flags &= ~PF_BLOCK_TS; }
diff --git a/block/blk.h b/block/blk.h index cbacf55d0b09..6a27b1a87c45 100644 --- a/block/blk.h +++ b/block/blk.h @@ -481,7 +481,8 @@ static inline void blk_free_queue_dispatch_async(struct request_queue *q)
static inline u64 blk_time_get_ns(void) { - struct blk_plug *plug = current->plug; + struct task_struct *tsk = current; + struct blk_plug *plug = tsk->plug;
if (!plug || !in_task()) return ktime_get_ns(); @@ -491,11 +492,11 @@ static inline u64 blk_time_get_ns(void) * a valid timestamp" separately, just accept that we'll do an extra * ktime_get_ns() if we just happen to get 0 as the current time. */ - if (!plug->cur_ktime) { - plug->cur_ktime = ktime_get_ns(); - current->flags |= PF_BLOCK_TS; + if (!tsk->_resvd->cur_ktime) { + tsk->_resvd->cur_ktime = ktime_get_ns(); + tsk->flags |= PF_BLOCK_TS; } - return plug->cur_ktime; + return tsk->_resvd->cur_ktime; }
static inline ktime_t blk_time_get(void) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 8fe611439db5..241f59eb5b64 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1372,7 +1372,6 @@ struct blk_plug { struct list_head list; /* requests */ struct list_head mq_list; /* blk-mq requests */ struct list_head cb_list; /* md requires an unplug callback */ - u64 cur_ktime; }; #define BLK_MAX_REQUEST_COUNT 16 #define BLK_PLUG_FLUSH_SIZE (128 * 1024) @@ -1444,7 +1443,7 @@ static inline void blk_plug_invalidate_ts(struct task_struct *tsk) struct blk_plug *plug = tsk->plug;
if (plug) - plug->cur_ktime = 0; + current->_resvd->cur_ktime = 0; current->flags &= ~PF_BLOCK_TS; }
diff --git a/include/linux/sched.h b/include/linux/sched.h index 14eba475138a..d2eceea955b0 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -635,6 +635,7 @@ struct task_struct_resvd { #ifdef CONFIG_QOS_SCHED_SMART_GRID struct sched_grid_qos *grid_qos; #endif + u64 cur_ktime; };
struct task_struct {