linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yu Kuai <yukuai1@huaweicloud.com>
To: Tejun Heo <tj@kernel.org>, Yu Kuai <yukuai1@huaweicloud.com>
Cc: hch@infradead.org, josef@toxicpanda.com, axboe@kernel.dk,
	cgroups@vger.kernel.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, yi.zhang@huawei.com,
	"yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH v2 1/2] blk-iocost: add refcounting for iocg
Date: Fri, 13 Jan 2023 09:25:11 +0800	[thread overview]
Message-ID: <ac95dfb8-b1b6-8916-bde8-1edb573e7ca5@huaweicloud.com> (raw)
In-Reply-To: <Y8CwwghZ0adMsHFC@slm.duckdns.org>

Hi,

在 2023/01/13 9:15, Tejun Heo 写道:
> Hello,
> 
> On Fri, Jan 13, 2023 at 09:10:25AM +0800, Yu Kuai wrote:
>>> only activate the policy when the controller is actually enabled. So, idk.
>>> What's wrong with synchronizing the two removal paths? blkcg policies are
>>> combinations of cgroups and block device configurations, so having exit
>>> paths from both sides is kinda natural.
>>
>> I still can't figure out how to synchronizing them will a mutex. Maybe
>> I'm being foolish...
> 
> Hmm... can't you just use e.g. per-bdev mutex which is grabbed by both
> blkg_free_workfn() and blkcg_deactivate_policy()?
> 

I think hold the lock in blkg_free_workfn() is too late, pd_free_fn()
for parent from blkcg_deactivate_policy() can be called first.

t1: remove cgroup t1/t2
blkcg_destroy_blkgs
  blkg_destroy
   percpu_ref_kill(&blkg->refcnt)
    blkg_release
     blkg_free
      schedule_work(&blkg->free_work)
      // t1 is done

t2: handle t1 from removing device
blkcg_deactivate_policy
  pd_free_fn
  // free parent
				t3: from t1
				blkg_free_workfn
				 pd_free_fn
				 // free child

Thanks,
Kuai


  reply	other threads:[~2023-01-13  1:25 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-27 12:55 [PATCH v2 0/2] blk-iocost: add refcounting for iocg and ioc Yu Kuai
2022-12-27 12:55 ` [PATCH v2 1/2] blk-iocost: add refcounting for iocg Yu Kuai
2023-01-04 21:44   ` Tejun Heo
2023-01-05  1:14     ` Yu Kuai
2023-01-05 18:32       ` Tejun Heo
2023-01-06  1:08         ` Yu Kuai
2023-01-06 20:18           ` Tejun Heo
2023-01-09  1:32             ` Yu Kuai
2023-01-09 18:23               ` Tejun Heo
2023-01-10  1:39                 ` Yu Kuai
2023-01-10 18:36                   ` Tejun Heo
2023-01-11  1:36                     ` Yu Kuai
2023-01-11 17:07                       ` Tejun Heo
2023-01-12  6:18                         ` Yu Kuai
2023-01-13  0:53                           ` Tejun Heo
2023-01-13  1:10                             ` Yu Kuai
2023-01-13  1:15                               ` Tejun Heo
2023-01-13  1:25                                 ` Yu Kuai [this message]
2023-01-13 17:16                                   ` Tejun Heo
2023-01-16  3:25                                     ` Yu Kuai
2022-12-27 12:55 ` [PATCH v2 2/2] blk-iocost: add refcounting for ioc Yu Kuai
2023-01-04 21:45   ` Tejun Heo

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=ac95dfb8-b1b6-8916-bde8-1edb573e7ca5@huaweicloud.com \
    --to=yukuai1@huaweicloud.com \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=hch@infradead.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).