Re: [PATCH RFC v2 2/6] blk-throttle: delay initialization until configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

在 2024/04/13 1:59, Tejun Heo 写道:
Hello,

On Sat, Apr 06, 2024 at 04:00:55PM +0800, Yu Kuai wrote:
@@ -1480,6 +1547,9 @@ void blk_throtl_cancel_bios(struct gendisk *disk)
  	struct cgroup_subsys_state *pos_css;
  	struct blkcg_gq *blkg;
+ if (!q->td)
+		return;

So, this naked test is safe because the interface functions are shut down by
the time this function is called.

  static inline bool blk_should_throtl(struct bio *bio)
  {
-	struct throtl_grp *tg = blkg_to_tg(bio->bi_blkg);
+	struct throtl_grp *tg;
  	int rw = bio_data_dir(bio);
+ if (!bio->bi_bdev->bd_queue->td)
+		return false;

and this one because ->td is set while the queue is frozen and this path
shouldn't be running while it gets set, right?

Yes, this is called under bio_queue_enter()

Can you please add comments explaining why those are safe? Otherwise, the
patch looks generally sane to me on the first glance. Can you please also
add how you tested the change?

And I realized that there are no tests for bkl-throttle from blktests,
and I'm using some other tests from our testers to cover basic
functionality. Perhaps will it make sense to add some tests to blktests?

Thanks,
Kuai


Thanks.






[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux