From d3bdf1e8a910c16359b1e95828fc811bd2280d69 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 15 Apr 2021 17:33:29 +0800 Subject: [PATCH] io-wq: remove now redundant struct io_wq_nulls_list mainline inclusion from mainline-5.5-rc1 commit 021d1cdda3875bf35edac9133335f622d7910abc category: feature bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=27 CVE: NA --------------------------- Since we don't iterate these lists anymore after commit: e61df66c69b1 ("io-wq: ensure free/busy list browsing see all items") we don't need to retain the nulls value we use for them. That means it's pretty pointless to wrap the hlist_nulls_head in a structure, so get rid of it. Signed-off-by: Jens Axboe Signed-off-by: Zhihao Cheng Signed-off-by: yangerkun Reviewed-by: zhangyi (F) Signed-off-by: Cheng Jian --- fs/io-wq.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/fs/io-wq.c b/fs/io-wq.c index bf36b6122997..b7eae2e866a3 100644 --- a/fs/io-wq.c +++ b/fs/io-wq.c @@ -60,11 +60,6 @@ struct io_worker { struct files_struct *restore_files; }; -struct io_wq_nulls_list { - struct hlist_nulls_head head; - unsigned long nulls; -}; - #if BITS_PER_LONG == 64 #define IO_WQ_HASH_ORDER 6 #else @@ -96,8 +91,8 @@ struct io_wqe { int node; struct io_wqe_acct acct[2]; - struct io_wq_nulls_list free_list; - struct io_wq_nulls_list busy_list; + struct hlist_nulls_head free_list; + struct hlist_nulls_head busy_list; struct list_head all_list; struct io_wq *wq; @@ -250,7 +245,7 @@ static bool io_wqe_activate_free_worker(struct io_wqe *wqe) struct hlist_nulls_node *n; struct io_worker *worker; - n = rcu_dereference(hlist_nulls_first_rcu(&wqe->free_list.head)); + n = rcu_dereference(hlist_nulls_first_rcu(&wqe->free_list)); if (is_a_nulls(n)) return false; @@ -326,8 +321,7 @@ static void __io_worker_busy(struct io_wqe *wqe, struct io_worker *worker, if (worker->flags & IO_WORKER_F_FREE) { worker->flags &= ~IO_WORKER_F_FREE; hlist_nulls_del_init_rcu(&worker->nulls_node); - hlist_nulls_add_head_rcu(&worker->nulls_node, - &wqe->busy_list.head); + hlist_nulls_add_head_rcu(&worker->nulls_node, &wqe->busy_list); } /* @@ -366,8 +360,7 @@ static bool __io_worker_idle(struct io_wqe *wqe, struct io_worker *worker) if (!(worker->flags & IO_WORKER_F_FREE)) { worker->flags |= IO_WORKER_F_FREE; hlist_nulls_del_init_rcu(&worker->nulls_node); - hlist_nulls_add_head_rcu(&worker->nulls_node, - &wqe->free_list.head); + hlist_nulls_add_head_rcu(&worker->nulls_node, &wqe->free_list); } return __io_worker_unuse(wqe, worker); @@ -593,7 +586,7 @@ static void create_io_worker(struct io_wq *wq, struct io_wqe *wqe, int index) } spin_lock_irq(&wqe->lock); - hlist_nulls_add_head_rcu(&worker->nulls_node, &wqe->free_list.head); + hlist_nulls_add_head_rcu(&worker->nulls_node, &wqe->free_list); list_add_tail_rcu(&worker->all_list, &wqe->all_list); worker->flags |= IO_WORKER_F_FREE; if (index == IO_WQ_ACCT_BOUND) @@ -618,7 +611,7 @@ static inline bool io_wqe_need_worker(struct io_wqe *wqe, int index) if (index == IO_WQ_ACCT_BOUND && !acct->nr_workers) return true; /* if we have available workers or no work, no need */ - if (!hlist_nulls_empty(&wqe->free_list.head) || !io_wqe_run_queue(wqe)) + if (!hlist_nulls_empty(&wqe->free_list) || !io_wqe_run_queue(wqe)) return false; return acct->nr_workers < acct->max_workers; } @@ -666,7 +659,7 @@ static bool io_wq_can_queue(struct io_wqe *wqe, struct io_wqe_acct *acct, return true; rcu_read_lock(); - free_worker = !hlist_nulls_empty(&wqe->free_list.head); + free_worker = !hlist_nulls_empty(&wqe->free_list); rcu_read_unlock(); if (free_worker) return true; @@ -1010,10 +1003,8 @@ struct io_wq *io_wq_create(unsigned bounded, struct mm_struct *mm, wqe->wq = wq; spin_lock_init(&wqe->lock); INIT_LIST_HEAD(&wqe->work_list); - INIT_HLIST_NULLS_HEAD(&wqe->free_list.head, 0); - wqe->free_list.nulls = 0; - INIT_HLIST_NULLS_HEAD(&wqe->busy_list.head, 1); - wqe->busy_list.nulls = 1; + INIT_HLIST_NULLS_HEAD(&wqe->free_list, 0); + INIT_HLIST_NULLS_HEAD(&wqe->busy_list, 1); INIT_LIST_HEAD(&wqe->all_list); i++; -- GitLab