All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] blk-cgroup: duplicated code refactor
@ 2022-06-29  7:09 Jason Yan
  2022-06-29  7:09 ` [PATCH v3 1/2] blk-cgroup: factor out blkcg_iostat_update() Jason Yan
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Jason Yan @ 2022-06-29  7:09 UTC (permalink / raw)
  To: tj, jack, hch, axboe; +Cc: linux-block, Jason Yan

Two duplicated code segment refactors. No functional change.

v2->v3: Fix indentation and add review tags.
v1->v2: Remove inline keyword of blkcg_iostat_update().

Jason Yan (2):
  blk-cgroup: factor out blkcg_iostat_update()
  blk-cgroup: factor out blkcg_free_all_cpd()

 block/blk-cgroup.c | 73 ++++++++++++++++++++++++----------------------
 1 file changed, 38 insertions(+), 35 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3 1/2] blk-cgroup: factor out blkcg_iostat_update()
  2022-06-29  7:09 [PATCH v3 0/2] blk-cgroup: duplicated code refactor Jason Yan
@ 2022-06-29  7:09 ` Jason Yan
  2022-06-29  7:09 ` [PATCH v3 2/2] blk-cgroup: factor out blkcg_free_all_cpd() Jason Yan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Jason Yan @ 2022-06-29  7:09 UTC (permalink / raw)
  To: tj, jack, hch, axboe; +Cc: linux-block, Jason Yan

To reduce some duplicated code, factor out blkcg_iostat_update(). No
functional change.

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-cgroup.c | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 764e740b0c0f..5326ae873f24 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -846,6 +846,21 @@ static void blkg_iostat_sub(struct blkg_iostat *dst, struct blkg_iostat *src)
 	}
 }
 
+static void blkcg_iostat_update(struct blkcg_gq *blkg, struct blkg_iostat *cur,
+				struct blkg_iostat *last)
+{
+	struct blkg_iostat delta;
+	unsigned long flags;
+
+	/* propagate percpu delta to global */
+	flags = u64_stats_update_begin_irqsave(&blkg->iostat.sync);
+	blkg_iostat_set(&delta, cur);
+	blkg_iostat_sub(&delta, last);
+	blkg_iostat_add(&blkg->iostat.cur, &delta);
+	blkg_iostat_add(last, &delta);
+	u64_stats_update_end_irqrestore(&blkg->iostat.sync, flags);
+}
+
 static void blkcg_rstat_flush(struct cgroup_subsys_state *css, int cpu)
 {
 	struct blkcg *blkcg = css_to_blkcg(css);
@@ -860,8 +875,7 @@ static void blkcg_rstat_flush(struct cgroup_subsys_state *css, int cpu)
 	hlist_for_each_entry_rcu(blkg, &blkcg->blkg_list, blkcg_node) {
 		struct blkcg_gq *parent = blkg->parent;
 		struct blkg_iostat_set *bisc = per_cpu_ptr(blkg->iostat_cpu, cpu);
-		struct blkg_iostat cur, delta;
-		unsigned long flags;
+		struct blkg_iostat cur;
 		unsigned int seq;
 
 		/* fetch the current per-cpu values */
@@ -870,23 +884,12 @@ static void blkcg_rstat_flush(struct cgroup_subsys_state *css, int cpu)
 			blkg_iostat_set(&cur, &bisc->cur);
 		} while (u64_stats_fetch_retry(&bisc->sync, seq));
 
-		/* propagate percpu delta to global */
-		flags = u64_stats_update_begin_irqsave(&blkg->iostat.sync);
-		blkg_iostat_set(&delta, &cur);
-		blkg_iostat_sub(&delta, &bisc->last);
-		blkg_iostat_add(&blkg->iostat.cur, &delta);
-		blkg_iostat_add(&bisc->last, &delta);
-		u64_stats_update_end_irqrestore(&blkg->iostat.sync, flags);
+		blkcg_iostat_update(blkg, &cur, &bisc->last);
 
 		/* propagate global delta to parent (unless that's root) */
-		if (parent && parent->parent) {
-			flags = u64_stats_update_begin_irqsave(&parent->iostat.sync);
-			blkg_iostat_set(&delta, &blkg->iostat.cur);
-			blkg_iostat_sub(&delta, &blkg->iostat.last);
-			blkg_iostat_add(&parent->iostat.cur, &delta);
-			blkg_iostat_add(&blkg->iostat.last, &delta);
-			u64_stats_update_end_irqrestore(&parent->iostat.sync, flags);
-		}
+		if (parent && parent->parent)
+			blkcg_iostat_update(parent, &blkg->iostat.cur,
+					    &blkg->iostat.last);
 	}
 
 	rcu_read_unlock();
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 2/2] blk-cgroup: factor out blkcg_free_all_cpd()
  2022-06-29  7:09 [PATCH v3 0/2] blk-cgroup: duplicated code refactor Jason Yan
  2022-06-29  7:09 ` [PATCH v3 1/2] blk-cgroup: factor out blkcg_iostat_update() Jason Yan
@ 2022-06-29  7:09 ` Jason Yan
  2022-06-29 17:09 ` [PATCH v3 0/2] blk-cgroup: duplicated code refactor Jens Axboe
  2022-06-29 17:10 ` Jens Axboe
  3 siblings, 0 replies; 10+ messages in thread
From: Jason Yan @ 2022-06-29  7:09 UTC (permalink / raw)
  To: tj, jack, hch, axboe; +Cc: linux-block, Jason Yan

To reduce some duplicated code, factor out blkcg_free_all_cpd(). No
functional change.

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-cgroup.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 5326ae873f24..f8d98a4f4aa1 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1532,6 +1532,18 @@ void blkcg_deactivate_policy(struct request_queue *q,
 }
 EXPORT_SYMBOL_GPL(blkcg_deactivate_policy);
 
+static void blkcg_free_all_cpd(struct blkcg_policy *pol)
+{
+	struct blkcg *blkcg;
+
+	list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) {
+		if (blkcg->cpd[pol->plid]) {
+			pol->cpd_free_fn(blkcg->cpd[pol->plid]);
+			blkcg->cpd[pol->plid] = NULL;
+		}
+	}
+}
+
 /**
  * blkcg_policy_register - register a blkcg policy
  * @pol: blkcg policy to register
@@ -1596,14 +1608,9 @@ int blkcg_policy_register(struct blkcg_policy *pol)
 	return 0;
 
 err_free_cpds:
-	if (pol->cpd_free_fn) {
-		list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) {
-			if (blkcg->cpd[pol->plid]) {
-				pol->cpd_free_fn(blkcg->cpd[pol->plid]);
-				blkcg->cpd[pol->plid] = NULL;
-			}
-		}
-	}
+	if (pol->cpd_free_fn)
+		blkcg_free_all_cpd(pol);
+
 	blkcg_policy[pol->plid] = NULL;
 err_unlock:
 	mutex_unlock(&blkcg_pol_mutex);
@@ -1620,8 +1627,6 @@ EXPORT_SYMBOL_GPL(blkcg_policy_register);
  */
 void blkcg_policy_unregister(struct blkcg_policy *pol)
 {
-	struct blkcg *blkcg;
-
 	mutex_lock(&blkcg_pol_register_mutex);
 
 	if (WARN_ON(blkcg_policy[pol->plid] != pol))
@@ -1636,14 +1641,9 @@ void blkcg_policy_unregister(struct blkcg_policy *pol)
 	/* remove cpds and unregister */
 	mutex_lock(&blkcg_pol_mutex);
 
-	if (pol->cpd_free_fn) {
-		list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) {
-			if (blkcg->cpd[pol->plid]) {
-				pol->cpd_free_fn(blkcg->cpd[pol->plid]);
-				blkcg->cpd[pol->plid] = NULL;
-			}
-		}
-	}
+	if (pol->cpd_free_fn)
+		blkcg_free_all_cpd(pol);
+
 	blkcg_policy[pol->plid] = NULL;
 
 	mutex_unlock(&blkcg_pol_mutex);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 0/2] blk-cgroup: duplicated code refactor
  2022-06-29  7:09 [PATCH v3 0/2] blk-cgroup: duplicated code refactor Jason Yan
  2022-06-29  7:09 ` [PATCH v3 1/2] blk-cgroup: factor out blkcg_iostat_update() Jason Yan
  2022-06-29  7:09 ` [PATCH v3 2/2] blk-cgroup: factor out blkcg_free_all_cpd() Jason Yan
@ 2022-06-29 17:09 ` Jens Axboe
  2022-06-30  1:46   ` Yu Kuai
  2022-06-30  8:16   ` John Garry
  2022-06-29 17:10 ` Jens Axboe
  3 siblings, 2 replies; 10+ messages in thread
From: Jens Axboe @ 2022-06-29 17:09 UTC (permalink / raw)
  To: Jason Yan, tj, jack, hch; +Cc: linux-block

On 6/29/22 1:09 AM, Jason Yan wrote:
> Two duplicated code segment refactors. No functional change.
> 
> v2->v3: Fix indentation and add review tags.
> v1->v2: Remove inline keyword of blkcg_iostat_update().
> 
> Jason Yan (2):
>   blk-cgroup: factor out blkcg_iostat_update()
>   blk-cgroup: factor out blkcg_free_all_cpd()
> 
>  block/blk-cgroup.c | 73 ++++++++++++++++++++++++----------------------
>  1 file changed, 38 insertions(+), 35 deletions(-)

Like I told Yu, stop using the huawei email until your MTA
misconfiguration issues are fixed. They end up in spam and risk getting
lost. This series was one of them.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 0/2] blk-cgroup: duplicated code refactor
  2022-06-29  7:09 [PATCH v3 0/2] blk-cgroup: duplicated code refactor Jason Yan
                   ` (2 preceding siblings ...)
  2022-06-29 17:09 ` [PATCH v3 0/2] blk-cgroup: duplicated code refactor Jens Axboe
@ 2022-06-29 17:10 ` Jens Axboe
  3 siblings, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2022-06-29 17:10 UTC (permalink / raw)
  To: tj, jack, Christoph Hellwig, yanaijie; +Cc: linux-block

On Wed, 29 Jun 2022 15:09:15 +0800, Jason Yan wrote:
> Two duplicated code segment refactors. No functional change.
> 
> v2->v3: Fix indentation and add review tags.
> v1->v2: Remove inline keyword of blkcg_iostat_update().
> 
> Jason Yan (2):
>   blk-cgroup: factor out blkcg_iostat_update()
>   blk-cgroup: factor out blkcg_free_all_cpd()
> 
> [...]

Applied, thanks!

[1/2] blk-cgroup: factor out blkcg_iostat_update()
      commit: 362b8c16f8fc73fddfe4bded25055fa0c9e2bf1e
[2/2] blk-cgroup: factor out blkcg_free_all_cpd()
      commit: e55cf798140518b900e5254093f1195f65c23026

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 0/2] blk-cgroup: duplicated code refactor
  2022-06-29 17:09 ` [PATCH v3 0/2] blk-cgroup: duplicated code refactor Jens Axboe
@ 2022-06-30  1:46   ` Yu Kuai
  2022-06-30  8:16   ` John Garry
  1 sibling, 0 replies; 10+ messages in thread
From: Yu Kuai @ 2022-06-30  1:46 UTC (permalink / raw)
  To: Jens Axboe, Jason Yan, tj, jack, hch; +Cc: linux-block

在 2022/06/30 1:09, Jens Axboe 写道:
> On 6/29/22 1:09 AM, Jason Yan wrote:
>> Two duplicated code segment refactors. No functional change.
>>
>> v2->v3: Fix indentation and add review tags.
>> v1->v2: Remove inline keyword of blkcg_iostat_update().
>>
>> Jason Yan (2):
>>    blk-cgroup: factor out blkcg_iostat_update()
>>    blk-cgroup: factor out blkcg_free_all_cpd()
>>
>>   block/blk-cgroup.c | 73 ++++++++++++++++++++++++----------------------
>>   1 file changed, 38 insertions(+), 35 deletions(-)
> 
> Like I told Yu, stop using the huawei email until your MTA
> misconfiguration issues are fixed. They end up in spam and risk getting
> lost. This series was one of them.
> 

Hi,

I'll try to push our IT to solve the issues, and in the meantime i'll
let my colleagues know about this. However, I'm afraid this can't be
avoid completely.

Thanks,
Kuai


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 0/2] blk-cgroup: duplicated code refactor
  2022-06-29 17:09 ` [PATCH v3 0/2] blk-cgroup: duplicated code refactor Jens Axboe
  2022-06-30  1:46   ` Yu Kuai
@ 2022-06-30  8:16   ` John Garry
  2022-06-30 13:10     ` Jens Axboe
  2022-06-30 18:03     ` Bart Van Assche
  1 sibling, 2 replies; 10+ messages in thread
From: John Garry @ 2022-06-30  8:16 UTC (permalink / raw)
  To: Jens Axboe, Jason Yan, tj, jack, hch; +Cc: linux-block

On 29/06/2022 18:09, Jens Axboe wrote:
> Like I told Yu, stop using the huawei email until your MTA
> misconfiguration issues are fixed. They end up in spam and risk getting
> lost. This series was one of them.

Hi Jens,

Just wondering - are there any of my mails in your spam folder?

thanks,
John

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 0/2] blk-cgroup: duplicated code refactor
  2022-06-30  8:16   ` John Garry
@ 2022-06-30 13:10     ` Jens Axboe
  2022-06-30 18:03     ` Bart Van Assche
  1 sibling, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2022-06-30 13:10 UTC (permalink / raw)
  To: John Garry, Jason Yan, tj, jack, hch; +Cc: linux-block

On 6/30/22 2:16 AM, John Garry wrote:
> On 29/06/2022 18:09, Jens Axboe wrote:
>> Like I told Yu, stop using the huawei email until your MTA
>> misconfiguration issues are fixed. They end up in spam and risk getting
>> lost. This series was one of them.
> 
> Hi Jens,
> 
> Just wondering - are there any of my mails in your spam folder?

Don't recall seeing any of yours in spam.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 0/2] blk-cgroup: duplicated code refactor
  2022-06-30  8:16   ` John Garry
  2022-06-30 13:10     ` Jens Axboe
@ 2022-06-30 18:03     ` Bart Van Assche
  2022-07-01  1:51       ` Jason Yan
  1 sibling, 1 reply; 10+ messages in thread
From: Bart Van Assche @ 2022-06-30 18:03 UTC (permalink / raw)
  To: John Garry, Jens Axboe, Jason Yan, tj, jack, hch; +Cc: linux-block

On 6/30/22 01:16, John Garry wrote:
> Just wondering - are there any of my mails in your spam folder?

This morning I found the following email from you in my spam folder:

https://lore.kernel.org/linux-scsi/82e30007-1ffc-92e4-38b5-eaf7dd2e316d@huawei.com/

I'm going to reinstall my email filter that keeps Huawei emails out of 
the spam folder.

If the following information has not yet been shared with your IT 
department, please share it: https://support.google.com/a/answer/174124

Bart.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 0/2] blk-cgroup: duplicated code refactor
  2022-06-30 18:03     ` Bart Van Assche
@ 2022-07-01  1:51       ` Jason Yan
  0 siblings, 0 replies; 10+ messages in thread
From: Jason Yan @ 2022-07-01  1:51 UTC (permalink / raw)
  To: Bart Van Assche, John Garry, Jens Axboe, tj, jack, hch; +Cc: linux-block

On 2022/7/1 2:03, Bart Van Assche wrote:
> On 6/30/22 01:16, John Garry wrote:
>> Just wondering - are there any of my mails in your spam folder?
> 
> This morning I found the following email from you in my spam folder:
> 
> https://lore.kernel.org/linux-scsi/82e30007-1ffc-92e4-38b5-eaf7dd2e316d@huawei.com/ 
> 
> 
> I'm going to reinstall my email filter that keeps Huawei emails out of 
> the spam folder.
> 
> If the following information has not yet been shared with your IT 
> department, please share it: https://support.google.com/a/answer/174124
> 
> Bart.
> .

Sorry to bring your guys so many troubles.

And thanks Bart. Yes our IT department is planning to support DKIM. But
this needs time and they have to consider the performance issues. And we
are going to try a workaround approach before they fix it entirely.

Thanks you so much again.

Jason.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-07-01  1:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29  7:09 [PATCH v3 0/2] blk-cgroup: duplicated code refactor Jason Yan
2022-06-29  7:09 ` [PATCH v3 1/2] blk-cgroup: factor out blkcg_iostat_update() Jason Yan
2022-06-29  7:09 ` [PATCH v3 2/2] blk-cgroup: factor out blkcg_free_all_cpd() Jason Yan
2022-06-29 17:09 ` [PATCH v3 0/2] blk-cgroup: duplicated code refactor Jens Axboe
2022-06-30  1:46   ` Yu Kuai
2022-06-30  8:16   ` John Garry
2022-06-30 13:10     ` Jens Axboe
2022-06-30 18:03     ` Bart Van Assche
2022-07-01  1:51       ` Jason Yan
2022-06-29 17:10 ` Jens Axboe

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.