Re: [PATCH] blkcg: Optimize exit to user space

From: Tejun Heo
Date: Wed Aug 13 2025 - 12:56:06 EST


On Wed, Aug 13, 2025 at 04:59:57PM +0200, Thomas Gleixner wrote:
> blkcg uses TIF_NOTIFY_RESUME to handle throttling on exit to user
> space. TIF_NOTIFY_RESUME is a multiplexing TIF bit, which is utilized by
> other entities as well.
>
> This results in a unconditional blkcg_maybe_throttle_current() call for
> every invocation of resume_user_mode_work(), which is a pointless exercise
> as most of the time there is no throttling work to do.
>
> Optimize this by doing a quick check of the throttling condition before
> invoking it.
>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Tejun Heo <tj@xxxxxxxxxx>
> Cc: Josef Bacik <josef@xxxxxxxxxxxxxx>
> Cc: Jens Axboe <axboe@xxxxxxxxx>
...
> -void blkcg_maybe_throttle_current(void)
> +void __blkcg_maybe_throttle_current(void)
> {
> struct gendisk *disk = current->throttle_disk;
> struct blkcg *blkcg;

A nit: __blkcg_maybe_throttle_current() ends up doing another NULL check.
Maybe drop that? Other than that,

Acked-by: Tejun Heo <tj@xxxxxxxxxx>

Thanks.

--
tejun