Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1595637 > unrolled thread

[PATCH v2] don't forget to call pd_online_fn when activate policy

Started byZhou Chengming <zhouchengming1@huawei.com>
First post2017-03-09 03:30 +0100
Last post2017-03-11 05:10 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] don't forget to call pd_online_fn when activate policy Zhou Chengming <zhouchengming1@huawei.com> - 2017-03-09 03:30 +0100
    Re: [PATCH v2] don't forget to call pd_online_fn when activate policy Jens Axboe <axboe@kernel.dk> - 2017-03-10 16:20 +0100
      Re: [PATCH v2] don't forget to call pd_online_fn when activate policy zhouchengming <zhouchengming1@huawei.com> - 2017-03-11 04:50 +0100
        Re: [PATCH v2] don't forget to call pd_online_fn when activate policy Jens Axboe <axboe@kernel.dk> - 2017-03-11 05:10 +0100

#1595637 — [PATCH v2] don't forget to call pd_online_fn when activate policy

FromZhou Chengming <zhouchengming1@huawei.com>
Date2017-03-09 03:30 +0100
Subject[PATCH v2] don't forget to call pd_online_fn when activate policy
Message-ID<tiW01-6VB-3@gated-at.bofh.it>
When we activate policy on the request_queue, we will create policy_date
for all the existing blkgs of the request_queue, so we should call
pd_init_fn() and pd_online_fn() on these newly created policy_data.

Signed-off-by: Zhou Chengming <zhouchengming1@huawei.com>
---
 block/blk-cgroup.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 8ba0af7..0dd9e76 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1254,6 +1254,12 @@ int blkcg_activate_policy(struct request_queue *q,
 		pd->plid = pol->plid;
 		if (pol->pd_init_fn)
 			pol->pd_init_fn(pd);
+
+		if (pol->pd_online_fn) {
+			spin_lock(blkg->blkcg->lock);
+			pol->pd_online_fn(pd);
+			spin_unlock(blkg->blkcg->lock);
+		}
 	}
 
 	__set_bit(pol->plid, q->blkcg_pols);
-- 
1.8.3.1

[toc] | [next] | [standalone]


#1597909

FromJens Axboe <axboe@kernel.dk>
Date2017-03-10 16:20 +0100
Message-ID<tjuuJ-5QV-3@gated-at.bofh.it>
In reply to#1595637
On 03/08/2017 07:20 PM, Zhou Chengming wrote:
> When we activate policy on the request_queue, we will create policy_date
> for all the existing blkgs of the request_queue, so we should call
> pd_init_fn() and pd_online_fn() on these newly created policy_data.
> 
> Signed-off-by: Zhou Chengming <zhouchengming1@huawei.com>
> ---
>  block/blk-cgroup.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
> index 8ba0af7..0dd9e76 100644
> --- a/block/blk-cgroup.c
> +++ b/block/blk-cgroup.c
> @@ -1254,6 +1254,12 @@ int blkcg_activate_policy(struct request_queue *q,
>  		pd->plid = pol->plid;
>  		if (pol->pd_init_fn)
>  			pol->pd_init_fn(pd);
> +
> +		if (pol->pd_online_fn) {
> +			spin_lock(blkg->blkcg->lock);
> +			pol->pd_online_fn(pd);
> +			spin_unlock(blkg->blkcg->lock);
> +		}

You didn't even compile this, did you?

-- 
Jens Axboe

[toc] | [prev] | [next] | [standalone]


#1598254

Fromzhouchengming <zhouchengming1@huawei.com>
Date2017-03-11 04:50 +0100
Message-ID<tjGcy-5iS-5@gated-at.bofh.it>
In reply to#1597909
On 2017/3/10 23:12, Jens Axboe wrote:
> On 03/08/2017 07:20 PM, Zhou Chengming wrote:
>> When we activate policy on the request_queue, we will create policy_date
>> for all the existing blkgs of the request_queue, so we should call
>> pd_init_fn() and pd_online_fn() on these newly created policy_data.
>>
>> Signed-off-by: Zhou Chengming<zhouchengming1@huawei.com>
>> ---
>>   block/blk-cgroup.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
>> index 8ba0af7..0dd9e76 100644
>> --- a/block/blk-cgroup.c
>> +++ b/block/blk-cgroup.c
>> @@ -1254,6 +1254,12 @@ int blkcg_activate_policy(struct request_queue *q,
>>   		pd->plid = pol->plid;
>>   		if (pol->pd_init_fn)
>>   			pol->pd_init_fn(pd);
>> +
>> +		if (pol->pd_online_fn) {
>> +			spin_lock(blkg->blkcg->lock);
>> +			pol->pd_online_fn(pd);
>> +			spin_unlock(blkg->blkcg->lock);
>> +		}
>
> You didn't even compile this, did you?
>

Sorry for my carelessness. It's a very minor change, so I didn't compile...
I will send a patch-v3 that I have compiled. Sorry again..

[toc] | [prev] | [next] | [standalone]


#1598255

FromJens Axboe <axboe@kernel.dk>
Date2017-03-11 05:10 +0100
Message-ID<tjGvU-5Ev-1@gated-at.bofh.it>
In reply to#1598254
> On Mar 10, 2017, at 8:46 PM, zhouchengming <zhouchengming1@huawei.com> wrote:
> 
>> On 2017/3/10 23:12, Jens Axboe wrote:
>>> On 03/08/2017 07:20 PM, Zhou Chengming wrote:
>>> When we activate policy on the request_queue, we will create policy_date
>>> for all the existing blkgs of the request_queue, so we should call
>>> pd_init_fn() and pd_online_fn() on these newly created policy_data.
>>> 
>>> Signed-off-by: Zhou Chengming<zhouchengming1@huawei.com>
>>> ---
>>>  block/blk-cgroup.c | 6 ++++++
>>>  1 file changed, 6 insertions(+)
>>> 
>>> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
>>> index 8ba0af7..0dd9e76 100644
>>> --- a/block/blk-cgroup.c
>>> +++ b/block/blk-cgroup.c
>>> @@ -1254,6 +1254,12 @@ int blkcg_activate_policy(struct request_queue *q,
>>>          pd->plid = pol->plid;
>>>          if (pol->pd_init_fn)
>>>              pol->pd_init_fn(pd);
>>> +
>>> +        if (pol->pd_online_fn) {
>>> +            spin_lock(blkg->blkcg->lock);
>>> +            pol->pd_online_fn(pd);
>>> +            spin_unlock(blkg->blkcg->lock);
>>> +        }
>> 
>> You didn't even compile this, did you?
>> 
> 
> Sorry for my carelessness. It's a very minor change, so I didn't compile...
> I will send a patch-v3 that I have compiled. Sorry again..

I don't care how trivial it seems. You always ALWAYS compile and test. Always. Don't ever send untested patches again, and not even compiling is unforgivable. 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web