All of lore.kernel.org
 help / color / mirror / Atom feed
From: Usama Arif <usama.arif@linux.dev>
To: Tejun Heo <tj@kernel.org>
Cc: axboe@kernel.dk, cgroups@vger.kernel.org, josef@toxicpanda.com,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	shakeel.butt@linux.dev, hannes@cmpxchg.org, riel@surriel.com,
	kernel-team@meta.com
Subject: Re: [PATCH 3/3] block: skip blkcg walk in blk_cgroup_congested() when nothing throttled
Date: Wed, 12 Aug 2026 10:56:58 +0100	[thread overview]
Message-ID: <e32cff4b-81a1-4846-ae97-6b7ee67b4b1d@linux.dev> (raw)
In-Reply-To: <anoe61mtiBJL3ofn@slm.duckdns.org>



On 10/08/2026 19:56, Tejun Heo wrote:
> Hello,
> 
> On Thu, Aug 06, 2026 at 11:37:20AM -0700, Usama Arif wrote:
>> @@ -53,6 +53,9 @@ EXPORT_SYMBOL_GPL(blkcg_root);
>>  struct cgroup_subsys_state * const blkcg_root_css = &blkcg_root.css;
>>  EXPORT_SYMBOL_GPL(blkcg_root_css);
>>  
>> +/* number of blkcgs with a non-zero congestion_count */
>> +atomic_t blkcg_congested_blkcgs __read_mostly = ATOMIC_INIT(0);
> 
> Maybe name it to clarify that this is a count. nr_ or _cnt or whatever.
> 
>> @@ -1350,6 +1353,16 @@ static void blkcg_css_free(struct cgroup_subsys_state *css)
>>  	struct blkcg *blkcg = css_to_blkcg(css);
>>  	int i;
>>  
>> +	/*
>> +	 * Every blkg holds a reference on this css and drops any delay it
>> +	 * still has from pd_free_fn(), so this is expected to be zero.  Should
>> +	 * a policy ever leave one behind, drop it here rather than let it pin
>> +	 * blkcg_congested_blkcgs and disable the fast path for the rest of the
>> +	 * boot.  Nothing can race with us at this point.
>> +	 */
>> +	if (atomic_xchg(&blkcg->congestion_count, 0) > 0)
>> +		atomic_dec(&blkcg_congested_blkcgs);
> 
> Maybe put WARN_ON_ONCE() on it?
> 
>> +static inline void blkcg_dec_congestion_count(struct blkcg *blkcg)
>> +{
>> +	if (atomic_dec_return(&blkcg->congestion_count) == 0)
>> +		atomic_dec(&blkcg_congested_blkcgs);
> 
> atomic_dec_and_test() is minutely more efficient.
> 
> Thanks.
> 

Thanks! Ack on all 3. I will wait a day incase there are more comments
and send a new revision tomorrow with all 3 addressed.


      reply	other threads:[~2026-08-12  9:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06 18:37 [PATCH 0/3] block: skip the blkcg walk in blk_cgroup_congested() when nothing is throttled Usama Arif
2026-08-06 18:37 ` [PATCH 1/3] blk-iolatency: clear delay state when freeing policy data Usama Arif
2026-08-10 18:48   ` Tejun Heo
2026-08-12  9:55     ` Usama Arif
2026-08-06 18:37 ` [PATCH 2/3] blk-iocost: " Usama Arif
2026-08-10 16:43   ` Usama Arif
2026-08-10 18:50     ` Tejun Heo
2026-08-06 18:37 ` [PATCH 3/3] block: skip blkcg walk in blk_cgroup_congested() when nothing throttled Usama Arif
2026-08-10 18:56   ` Tejun Heo
2026-08-12  9:56     ` Usama Arif [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e32cff4b-81a1-4846-ae97-6b7ee67b4b1d@linux.dev \
    --to=usama.arif@linux.dev \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@meta.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@surriel.com \
    --cc=shakeel.butt@linux.dev \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.