Message ID | 20250308162312.1640828-4-ming.lei@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | loop: improve loop aio perf by IOCB_NOWAIT | expand |
Hi Ming, kernel test robot noticed the following build warnings: [auto build test WARNING on axboe-block/for-next] [also build test WARNING on linus/master v6.14-rc5 next-20250307] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Ming-Lei/loop-remove-rw-parameter-from-lo_rw_aio/20250309-002548 base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next patch link: https://lore.kernel.org/r/20250308162312.1640828-4-ming.lei%40redhat.com patch subject: [RESEND PATCH 3/5] loop: add helper loop_queue_work_prep config: arc-randconfig-001-20250309 (https://download.01.org/0day-ci/archive/20250309/202503091413.vbFFy32o-lkp@intel.com/config) compiler: arceb-elf-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250309/202503091413.vbFFy32o-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202503091413.vbFFy32o-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/block/loop.c: In function 'loop_queue_work_prep': >> drivers/block/loop.c:862:25: warning: unused variable 'rq' [-Wunused-variable] 862 | struct request *rq = blk_mq_rq_from_pdu(cmd); | ^~ vim +/rq +862 drivers/block/loop.c 859 860 static void loop_queue_work_prep(struct loop_cmd *cmd) 861 { > 862 struct request *rq = blk_mq_rq_from_pdu(cmd); 863 864 /* always use the first bio's css */ 865 cmd->blkcg_css = NULL; 866 cmd->memcg_css = NULL; 867 #ifdef CONFIG_BLK_CGROUP 868 if (rq->bio) { 869 cmd->blkcg_css = bio_blkcg_css(rq->bio); 870 #ifdef CONFIG_MEMCG 871 if (cmd->blkcg_css) { 872 cmd->memcg_css = 873 cgroup_get_e_css(cmd->blkcg_css->cgroup, 874 &memory_cgrp_subsys); 875 } 876 #endif 877 } 878 #endif 879 } 880
On Sun, Mar 09, 2025 at 12:23:07AM +0800, Ming Lei wrote: > Add helper loop_queue_work_prep() for making loop_queue_rq() more > readable. Looking at this and the finaly result I don't really see any advantage over just moving the code into loop_queue_work.
On Mon, Mar 10, 2025 at 12:11:20PM +0100, Christoph Hellwig wrote: > On Sun, Mar 09, 2025 at 12:23:07AM +0800, Ming Lei wrote: > > Add helper loop_queue_work_prep() for making loop_queue_rq() more > > readable. > > Looking at this and the finaly result I don't really see any advantage > over just moving the code into loop_queue_work. loop_queue_work() is required for handling -EAGAIN, that is why I move loop_queue_work_prep() into loop_queue_work(). Thanks, Ming
On Tue, Mar 11, 2025 at 09:21:14AM +0800, Ming Lei wrote: > On Mon, Mar 10, 2025 at 12:11:20PM +0100, Christoph Hellwig wrote: > > On Sun, Mar 09, 2025 at 12:23:07AM +0800, Ming Lei wrote: > > > Add helper loop_queue_work_prep() for making loop_queue_rq() more > > > readable. > > > > Looking at this and the finaly result I don't really see any advantage > > over just moving the code into loop_queue_work. > > loop_queue_work() is required for handling -EAGAIN, that is why I move > loop_queue_work_prep() into loop_queue_work(). Yes, but please just add the code directly to loop_queue_work instead of adding a not very clearly defined helper.
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index eae38cd38b7b..9f8d32d2dc4d 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -859,6 +859,27 @@ static inline int queue_on_root_worker(struct cgroup_subsys_state *css) } #endif +static void loop_queue_work_prep(struct loop_cmd *cmd) +{ + struct request *rq = blk_mq_rq_from_pdu(cmd); + + /* always use the first bio's css */ + cmd->blkcg_css = NULL; + cmd->memcg_css = NULL; +#ifdef CONFIG_BLK_CGROUP + if (rq->bio) { + cmd->blkcg_css = bio_blkcg_css(rq->bio); +#ifdef CONFIG_MEMCG + if (cmd->blkcg_css) { + cmd->memcg_css = + cgroup_get_e_css(cmd->blkcg_css->cgroup, + &memory_cgrp_subsys); + } +#endif + } +#endif +} + static void loop_queue_work(struct loop_device *lo, struct loop_cmd *cmd) { struct rb_node **node, *parent = NULL; @@ -866,6 +887,8 @@ static void loop_queue_work(struct loop_device *lo, struct loop_cmd *cmd) struct work_struct *work; struct list_head *cmd_list; + loop_queue_work_prep(cmd); + spin_lock_irq(&lo->lo_work_lock); if (queue_on_root_worker(cmd->blkcg_css)) @@ -1903,21 +1926,6 @@ static blk_status_t loop_queue_rq(struct blk_mq_hw_ctx *hctx, break; } - /* always use the first bio's css */ - cmd->blkcg_css = NULL; - cmd->memcg_css = NULL; -#ifdef CONFIG_BLK_CGROUP - if (rq->bio) { - cmd->blkcg_css = bio_blkcg_css(rq->bio); -#ifdef CONFIG_MEMCG - if (cmd->blkcg_css) { - cmd->memcg_css = - cgroup_get_e_css(cmd->blkcg_css->cgroup, - &memory_cgrp_subsys); - } -#endif - } -#endif loop_queue_work(lo, cmd); return BLK_STS_OK;
Add helper loop_queue_work_prep() for making loop_queue_rq() more readable. Signed-off-by: Ming Lei <ming.lei@redhat.com> --- drivers/block/loop.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-)