public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cgroup: minor cleanup for cgroup_local_stat_show()
@ 2023-07-23  3:19 Miaohe Lin
       [not found] ` <20230723031932.3152951-1-linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Miaohe Lin @ 2023-07-23  3:19 UTC (permalink / raw)
  To: tj, hannes, lizefan.x; +Cc: cgroups, linux-kernel, linmiaohe

Make it under CONFIG_CGROUP_SCHED to rid of __maybe_unused annotation.
Also put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED as it's only
called when CONFIG_CGROUP_SCHED. No functional change intended.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 kernel/cgroup/cgroup.c | 63 ++++++++++++++++++++++--------------------
 1 file changed, 33 insertions(+), 30 deletions(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 31603146e7c2..7296331c7582 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -492,28 +492,6 @@ static struct cgroup_subsys_state *cgroup_css(struct cgroup *cgrp,
 		return &cgrp->self;
 }
 
-/**
- * cgroup_tryget_css - try to get a cgroup's css for the specified subsystem
- * @cgrp: the cgroup of interest
- * @ss: the subsystem of interest
- *
- * Find and get @cgrp's css associated with @ss.  If the css doesn't exist
- * or is offline, %NULL is returned.
- */
-static struct cgroup_subsys_state *cgroup_tryget_css(struct cgroup *cgrp,
-						     struct cgroup_subsys *ss)
-{
-	struct cgroup_subsys_state *css;
-
-	rcu_read_lock();
-	css = cgroup_css(cgrp, ss);
-	if (css && !css_tryget_online(css))
-		css = NULL;
-	rcu_read_unlock();
-
-	return css;
-}
-
 /**
  * cgroup_e_css_by_mask - obtain a cgroup's effective css for the specified ss
  * @cgrp: the cgroup of interest
@@ -3655,6 +3633,28 @@ static int cgroup_stat_show(struct seq_file *seq, void *v)
 }
 
 #ifdef CONFIG_CGROUP_SCHED
+/**
+ * cgroup_tryget_css - try to get a cgroup's css for the specified subsystem
+ * @cgrp: the cgroup of interest
+ * @ss: the subsystem of interest
+ *
+ * Find and get @cgrp's css associated with @ss.  If the css doesn't exist
+ * or is offline, %NULL is returned.
+ */
+static struct cgroup_subsys_state *cgroup_tryget_css(struct cgroup *cgrp,
+						     struct cgroup_subsys *ss)
+{
+	struct cgroup_subsys_state *css;
+
+	rcu_read_lock();
+	css = cgroup_css(cgrp, ss);
+	if (css && !css_tryget_online(css))
+		css = NULL;
+	rcu_read_unlock();
+
+	return css;
+}
+
 static int cgroup_extra_stat_show(struct seq_file *seq, int ssid)
 {
 	struct cgroup *cgrp = seq_css(seq)->cgroup;
@@ -3686,8 +3686,9 @@ static int cpu_stat_show(struct seq_file *seq, void *v)
 	return ret;
 }
 
-static int __maybe_unused cgroup_local_stat_show(struct seq_file *seq,
-						 struct cgroup *cgrp, int ssid)
+#ifdef CONFIG_CGROUP_SCHED
+static int cgroup_local_stat_show(struct seq_file *seq,
+				  struct cgroup *cgrp, int ssid)
 {
 	struct cgroup_subsys *ss = cgroup_subsys[ssid];
 	struct cgroup_subsys_state *css;
@@ -3707,14 +3708,16 @@ static int __maybe_unused cgroup_local_stat_show(struct seq_file *seq,
 
 static int cpu_local_stat_show(struct seq_file *seq, void *v)
 {
-	struct cgroup __maybe_unused *cgrp = seq_css(seq)->cgroup;
-	int ret = 0;
+	struct cgroup *cgrp = seq_css(seq)->cgroup;
 
-#ifdef CONFIG_CGROUP_SCHED
-	ret = cgroup_local_stat_show(seq, cgrp, cpu_cgrp_id);
-#endif
-	return ret;
+	return cgroup_local_stat_show(seq, cgrp, cpu_cgrp_id);
+}
+#else
+static int cpu_local_stat_show(struct seq_file *seq, void *v)
+{
+	return 0;
 }
+#endif
 
 #ifdef CONFIG_PSI
 static int cgroup_io_pressure_show(struct seq_file *seq, void *v)
-- 
2.33.0


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

* Re: [PATCH] cgroup: minor cleanup for cgroup_local_stat_show()
       [not found] ` <20230723031932.3152951-1-linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2023-07-25 21:53   ` Tejun Heo
       [not found]     ` <ZMBERCXR27X_gRAt-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Tejun Heo @ 2023-07-25 21:53 UTC (permalink / raw)
  To: Miaohe Lin
  Cc: hannes-druUgvl0LCNAfugRpC6u6w, lizefan.x-EC8Uxl6Npydl57MIdRCFDg,
	cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Sun, Jul 23, 2023 at 11:19:32AM +0800, Miaohe Lin wrote:
> Make it under CONFIG_CGROUP_SCHED to rid of __maybe_unused annotation.
> Also put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED as it's only
> called when CONFIG_CGROUP_SCHED. No functional change intended.
> 
> Signed-off-by: Miaohe Lin <linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

Patch doesn't apply to cgroup/for-6.6. Can you please respin?

Thanks.

-- 
tejun

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

* Re: [PATCH] cgroup: minor cleanup for cgroup_local_stat_show()
       [not found]     ` <ZMBERCXR27X_gRAt-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
@ 2023-07-26  1:06       ` Miaohe Lin
       [not found]         ` <ec3df402-7681-3d0c-b9ce-d50eb7383b1e-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Miaohe Lin @ 2023-07-26  1:06 UTC (permalink / raw)
  To: Tejun Heo
  Cc: hannes-druUgvl0LCNAfugRpC6u6w, lizefan.x-EC8Uxl6Npydl57MIdRCFDg,
	cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On 2023/7/26 5:53, Tejun Heo wrote:
> On Sun, Jul 23, 2023 at 11:19:32AM +0800, Miaohe Lin wrote:
>> Make it under CONFIG_CGROUP_SCHED to rid of __maybe_unused annotation.
>> Also put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED as it's only
>> called when CONFIG_CGROUP_SCHED. No functional change intended.
>>
>> Signed-off-by: Miaohe Lin <linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> 
> Patch doesn't apply to cgroup/for-6.6. Can you please respin?

Sure. Will resend the patch based on cgroup/for-6.6.

Thanks.



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

* Re: [PATCH] cgroup: minor cleanup for cgroup_local_stat_show()
       [not found]         ` <ec3df402-7681-3d0c-b9ce-d50eb7383b1e-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2023-07-27 11:50           ` Miaohe Lin
       [not found]             ` <719a19c4-3be5-2260-7349-b3f1bb774f4f-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Miaohe Lin @ 2023-07-27 11:50 UTC (permalink / raw)
  To: Tejun Heo
  Cc: hannes-druUgvl0LCNAfugRpC6u6w, lizefan.x-EC8Uxl6Npydl57MIdRCFDg,
	cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On 2023/7/26 9:06, Miaohe Lin wrote:
> On 2023/7/26 5:53, Tejun Heo wrote:
>> On Sun, Jul 23, 2023 at 11:19:32AM +0800, Miaohe Lin wrote:
>>> Make it under CONFIG_CGROUP_SCHED to rid of __maybe_unused annotation.
>>> Also put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED as it's only
>>> called when CONFIG_CGROUP_SCHED. No functional change intended.
>>>
>>> Signed-off-by: Miaohe Lin <linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>>
>> Patch doesn't apply to cgroup/for-6.6. Can you please respin?
> 
> Sure. Will resend the patch based on cgroup/for-6.6.

The commit "sched: add throttled time stat for throttled children" is still in the linux-next tree. So I think I have
to wait for it to be merged into cgroup tree first.

[1] https://lore.kernel.org/all/20230620183247.737942-2-joshdon-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org/

Thanks.

> 
> Thanks.
> 
> 


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

* Re: [PATCH] cgroup: minor cleanup for cgroup_local_stat_show()
       [not found]             ` <719a19c4-3be5-2260-7349-b3f1bb774f4f-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2023-07-31 23:47               ` Tejun Heo
       [not found]                 ` <ZMhIFUsxEtA_B781-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Tejun Heo @ 2023-07-31 23:47 UTC (permalink / raw)
  To: Miaohe Lin
  Cc: hannes-druUgvl0LCNAfugRpC6u6w, lizefan.x-EC8Uxl6Npydl57MIdRCFDg,
	cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Thu, Jul 27, 2023 at 07:50:11PM +0800, Miaohe Lin wrote:
> On 2023/7/26 9:06, Miaohe Lin wrote:
> > On 2023/7/26 5:53, Tejun Heo wrote:
> >> On Sun, Jul 23, 2023 at 11:19:32AM +0800, Miaohe Lin wrote:
> >>> Make it under CONFIG_CGROUP_SCHED to rid of __maybe_unused annotation.
> >>> Also put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED as it's only
> >>> called when CONFIG_CGROUP_SCHED. No functional change intended.
> >>>
> >>> Signed-off-by: Miaohe Lin <linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> >>
> >> Patch doesn't apply to cgroup/for-6.6. Can you please respin?
> > 
> > Sure. Will resend the patch based on cgroup/for-6.6.
> 
> The commit "sched: add throttled time stat for throttled children" is still in the linux-next tree. So I think I have
> to wait for it to be merged into cgroup tree first.

You can just send the patch against cgroup/for-6.6 branch. We can sort out
the merge conflicts later.

Thanks.

-- 
tejun

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

* Re: [PATCH] cgroup: minor cleanup for cgroup_local_stat_show()
       [not found]                 ` <ZMhIFUsxEtA_B781-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
@ 2023-08-01  7:48                   ` Miaohe Lin
       [not found]                     ` <3ec1f5d9-4887-4583-a973-92298a9bc924-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Miaohe Lin @ 2023-08-01  7:48 UTC (permalink / raw)
  To: Tejun Heo
  Cc: hannes-druUgvl0LCNAfugRpC6u6w, lizefan.x-EC8Uxl6Npydl57MIdRCFDg,
	cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On 2023/8/1 7:47, Tejun Heo wrote:
> On Thu, Jul 27, 2023 at 07:50:11PM +0800, Miaohe Lin wrote:
>> On 2023/7/26 9:06, Miaohe Lin wrote:
>>> On 2023/7/26 5:53, Tejun Heo wrote:
>>>> On Sun, Jul 23, 2023 at 11:19:32AM +0800, Miaohe Lin wrote:
>>>>> Make it under CONFIG_CGROUP_SCHED to rid of __maybe_unused annotation.
>>>>> Also put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED as it's only
>>>>> called when CONFIG_CGROUP_SCHED. No functional change intended.
>>>>>
>>>>> Signed-off-by: Miaohe Lin <linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>>>>
>>>> Patch doesn't apply to cgroup/for-6.6. Can you please respin?
>>>
>>> Sure. Will resend the patch based on cgroup/for-6.6.
>>
>> The commit "sched: add throttled time stat for throttled children" is still in the linux-next tree. So I think I have
>> to wait for it to be merged into cgroup tree first.
> 
> You can just send the patch against cgroup/for-6.6 branch. We can sort out
> the merge conflicts later.

Do you mean send the patch against cgroup/for-6.6 branch assuming commit "sched: add throttled time stat for throttled children"
has been merged into cgroup/for-6.6 branch? It seems the current code in that branch is fine itself.

Thanks for your advice.



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

* Re: [PATCH] cgroup: minor cleanup for cgroup_local_stat_show()
       [not found]                     ` <3ec1f5d9-4887-4583-a973-92298a9bc924-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2023-08-02 19:39                       ` Tejun Heo
       [not found]                         ` <ZMqxCVOkU7pKK9OO-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Tejun Heo @ 2023-08-02 19:39 UTC (permalink / raw)
  To: Miaohe Lin
  Cc: hannes-druUgvl0LCNAfugRpC6u6w, lizefan.x-EC8Uxl6Npydl57MIdRCFDg,
	cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Tue, Aug 01, 2023 at 03:48:09PM +0800, Miaohe Lin wrote:
> On 2023/8/1 7:47, Tejun Heo wrote:
> > On Thu, Jul 27, 2023 at 07:50:11PM +0800, Miaohe Lin wrote:
> >> On 2023/7/26 9:06, Miaohe Lin wrote:
> >>> On 2023/7/26 5:53, Tejun Heo wrote:
> >>>> On Sun, Jul 23, 2023 at 11:19:32AM +0800, Miaohe Lin wrote:
> >>>>> Make it under CONFIG_CGROUP_SCHED to rid of __maybe_unused annotation.
> >>>>> Also put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED as it's only
> >>>>> called when CONFIG_CGROUP_SCHED. No functional change intended.
> >>>>>
> >>>>> Signed-off-by: Miaohe Lin <linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> >>>>
> >>>> Patch doesn't apply to cgroup/for-6.6. Can you please respin?
> >>>
> >>> Sure. Will resend the patch based on cgroup/for-6.6.
> >>
> >> The commit "sched: add throttled time stat for throttled children" is still in the linux-next tree. So I think I have
> >> to wait for it to be merged into cgroup tree first.
> > 
> > You can just send the patch against cgroup/for-6.6 branch. We can sort out
> > the merge conflicts later.
> 
> Do you mean send the patch against cgroup/for-6.6 branch assuming commit "sched: add throttled time stat for throttled children"
> has been merged into cgroup/for-6.6 branch? It seems the current code in that branch is fine itself.

Ah, I see. That patch isn't going to go through cgroup/for-6.6. It will go
directly from -mm to mainline when the merge window opens. Can you please
resend the patch to Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> with me cc'd?

Thanks.

-- 
tejun

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

* Re: [PATCH] cgroup: minor cleanup for cgroup_local_stat_show()
       [not found]                         ` <ZMqxCVOkU7pKK9OO-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
@ 2023-08-03  1:38                           ` Miaohe Lin
  0 siblings, 0 replies; 11+ messages in thread
From: Miaohe Lin @ 2023-08-03  1:38 UTC (permalink / raw)
  To: Tejun Heo
  Cc: hannes-druUgvl0LCNAfugRpC6u6w, lizefan.x-EC8Uxl6Npydl57MIdRCFDg,
	cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On 2023/8/3 3:39, Tejun Heo wrote:
> On Tue, Aug 01, 2023 at 03:48:09PM +0800, Miaohe Lin wrote:
>> On 2023/8/1 7:47, Tejun Heo wrote:
>>> On Thu, Jul 27, 2023 at 07:50:11PM +0800, Miaohe Lin wrote:
>>>> On 2023/7/26 9:06, Miaohe Lin wrote:
>>>>> On 2023/7/26 5:53, Tejun Heo wrote:
>>>>>> On Sun, Jul 23, 2023 at 11:19:32AM +0800, Miaohe Lin wrote:
>>>>>>> Make it under CONFIG_CGROUP_SCHED to rid of __maybe_unused annotation.
>>>>>>> Also put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED as it's only
>>>>>>> called when CONFIG_CGROUP_SCHED. No functional change intended.
>>>>>>>
>>>>>>> Signed-off-by: Miaohe Lin <linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>>>>>>
>>>>>> Patch doesn't apply to cgroup/for-6.6. Can you please respin?
>>>>>
>>>>> Sure. Will resend the patch based on cgroup/for-6.6.
>>>>
>>>> The commit "sched: add throttled time stat for throttled children" is still in the linux-next tree. So I think I have
>>>> to wait for it to be merged into cgroup tree first.
>>>
>>> You can just send the patch against cgroup/for-6.6 branch. We can sort out
>>> the merge conflicts later.
>>
>> Do you mean send the patch against cgroup/for-6.6 branch assuming commit "sched: add throttled time stat for throttled children"
>> has been merged into cgroup/for-6.6 branch? It seems the current code in that branch is fine itself.
> 
> Ah, I see. That patch isn't going to go through cgroup/for-6.6. It will go
> directly from -mm to mainline when the merge window opens. Can you please
> resend the patch to Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> with me cc'd?
> 

Will do. Thanks. :)


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

* [PATCH] cgroup: minor cleanup for cgroup_local_stat_show()
@ 2023-08-03 11:31 Miaohe Lin
       [not found] ` <20230803113123.577023-1-linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Miaohe Lin @ 2023-08-03 11:31 UTC (permalink / raw)
  To: akpm; +Cc: tj, hannes, lizefan.x, cgroups, linux-kernel, linmiaohe

Make it under CONFIG_CGROUP_SCHED to rid of __maybe_unused annotation.
Also put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED as it's only
called when CONFIG_CGROUP_SCHED. No functional change intended.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 kernel/cgroup/cgroup.c | 63 ++++++++++++++++++++++--------------------
 1 file changed, 33 insertions(+), 30 deletions(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index c2c97529235a..e9239651cf4a 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -492,28 +492,6 @@ static struct cgroup_subsys_state *cgroup_css(struct cgroup *cgrp,
 		return &cgrp->self;
 }
 
-/**
- * cgroup_tryget_css - try to get a cgroup's css for the specified subsystem
- * @cgrp: the cgroup of interest
- * @ss: the subsystem of interest
- *
- * Find and get @cgrp's css associated with @ss.  If the css doesn't exist
- * or is offline, %NULL is returned.
- */
-static struct cgroup_subsys_state *cgroup_tryget_css(struct cgroup *cgrp,
-						     struct cgroup_subsys *ss)
-{
-	struct cgroup_subsys_state *css;
-
-	rcu_read_lock();
-	css = cgroup_css(cgrp, ss);
-	if (css && !css_tryget_online(css))
-		css = NULL;
-	rcu_read_unlock();
-
-	return css;
-}
-
 /**
  * cgroup_e_css_by_mask - obtain a cgroup's effective css for the specified ss
  * @cgrp: the cgroup of interest
@@ -3655,6 +3633,28 @@ static int cgroup_stat_show(struct seq_file *seq, void *v)
 }
 
 #ifdef CONFIG_CGROUP_SCHED
+/**
+ * cgroup_tryget_css - try to get a cgroup's css for the specified subsystem
+ * @cgrp: the cgroup of interest
+ * @ss: the subsystem of interest
+ *
+ * Find and get @cgrp's css associated with @ss.  If the css doesn't exist
+ * or is offline, %NULL is returned.
+ */
+static struct cgroup_subsys_state *cgroup_tryget_css(struct cgroup *cgrp,
+						     struct cgroup_subsys *ss)
+{
+	struct cgroup_subsys_state *css;
+
+	rcu_read_lock();
+	css = cgroup_css(cgrp, ss);
+	if (css && !css_tryget_online(css))
+		css = NULL;
+	rcu_read_unlock();
+
+	return css;
+}
+
 static int cgroup_extra_stat_show(struct seq_file *seq, int ssid)
 {
 	struct cgroup *cgrp = seq_css(seq)->cgroup;
@@ -3686,8 +3686,9 @@ static int cpu_stat_show(struct seq_file *seq, void *v)
 	return ret;
 }
 
-static int __maybe_unused cgroup_local_stat_show(struct seq_file *seq,
-						 struct cgroup *cgrp, int ssid)
+#ifdef CONFIG_CGROUP_SCHED
+static int cgroup_local_stat_show(struct seq_file *seq,
+				  struct cgroup *cgrp, int ssid)
 {
 	struct cgroup_subsys *ss = cgroup_subsys[ssid];
 	struct cgroup_subsys_state *css;
@@ -3707,14 +3708,16 @@ static int __maybe_unused cgroup_local_stat_show(struct seq_file *seq,
 
 static int cpu_local_stat_show(struct seq_file *seq, void *v)
 {
-	struct cgroup __maybe_unused *cgrp = seq_css(seq)->cgroup;
-	int ret = 0;
+	struct cgroup *cgrp = seq_css(seq)->cgroup;
 
-#ifdef CONFIG_CGROUP_SCHED
-	ret = cgroup_local_stat_show(seq, cgrp, cpu_cgrp_id);
-#endif
-	return ret;
+	return cgroup_local_stat_show(seq, cgrp, cpu_cgrp_id);
+}
+#else
+static int cpu_local_stat_show(struct seq_file *seq, void *v)
+{
+	return 0;
 }
+#endif
 
 #ifdef CONFIG_PSI
 static int cgroup_io_pressure_show(struct seq_file *seq, void *v)
-- 
2.33.0


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

* Re: [PATCH] cgroup: minor cleanup for cgroup_local_stat_show()
       [not found] ` <20230803113123.577023-1-linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2023-08-03 14:27   ` Johannes Weiner
       [not found]     ` <20230803142758.GC219857-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Johannes Weiner @ 2023-08-03 14:27 UTC (permalink / raw)
  To: Miaohe Lin
  Cc: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, tj-DgEjT+Ai2ygdnm+yROfE0A,
	lizefan.x-EC8Uxl6Npydl57MIdRCFDg, cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Thu, Aug 03, 2023 at 07:31:23PM +0800, Miaohe Lin wrote:
> Make it under CONFIG_CGROUP_SCHED to rid of __maybe_unused annotation.
> Also put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED as it's only
> called when CONFIG_CGROUP_SCHED. No functional change intended.
> 
> Signed-off-by: Miaohe Lin <linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

Acked-by: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>

> @@ -3686,8 +3686,9 @@ static int cpu_stat_show(struct seq_file *seq, void *v)
>  	return ret;
>  }
>  
> -static int __maybe_unused cgroup_local_stat_show(struct seq_file *seq,
> -						 struct cgroup *cgrp, int ssid)
> +#ifdef CONFIG_CGROUP_SCHED
> +static int cgroup_local_stat_show(struct seq_file *seq,
> +				  struct cgroup *cgrp, int ssid)

Andrew, this is based on "sched: add throttled time stat for throttled
children" in -next (coming in from -tip). Hence the routing through
you rather than the cgroup tree.

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

* Re: [PATCH] cgroup: minor cleanup for cgroup_local_stat_show()
       [not found]     ` <20230803142758.GC219857-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
@ 2023-08-03 17:05       ` Andrew Morton
  0 siblings, 0 replies; 11+ messages in thread
From: Andrew Morton @ 2023-08-03 17:05 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Miaohe Lin, tj-DgEjT+Ai2ygdnm+yROfE0A,
	lizefan.x-EC8Uxl6Npydl57MIdRCFDg, cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Thu, 3 Aug 2023 10:27:58 -0400 Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org> wrote:

> > @@ -3686,8 +3686,9 @@ static int cpu_stat_show(struct seq_file *seq, void *v)
> >  	return ret;
> >  }
> >  
> > -static int __maybe_unused cgroup_local_stat_show(struct seq_file *seq,
> > -						 struct cgroup *cgrp, int ssid)
> > +#ifdef CONFIG_CGROUP_SCHED
> > +static int cgroup_local_stat_show(struct seq_file *seq,
> > +				  struct cgroup *cgrp, int ssid)
> 
> Andrew, this is based on "sched: add throttled time stat for throttled
> children" in -next (coming in from -tip). Hence the routing through
> you rather than the cgroup tree.

Since switching to the more gitty workflow I have lost the power to
carry patches against -next.  I could regain that power I guess, but
this is the first time the requirement has come up.

So for now I'll save this patch away for the next -rc cycle.

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

end of thread, other threads:[~2023-08-03 17:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-03 11:31 [PATCH] cgroup: minor cleanup for cgroup_local_stat_show() Miaohe Lin
     [not found] ` <20230803113123.577023-1-linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2023-08-03 14:27   ` Johannes Weiner
     [not found]     ` <20230803142758.GC219857-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2023-08-03 17:05       ` Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2023-07-23  3:19 Miaohe Lin
     [not found] ` <20230723031932.3152951-1-linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2023-07-25 21:53   ` Tejun Heo
     [not found]     ` <ZMBERCXR27X_gRAt-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2023-07-26  1:06       ` Miaohe Lin
     [not found]         ` <ec3df402-7681-3d0c-b9ce-d50eb7383b1e-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2023-07-27 11:50           ` Miaohe Lin
     [not found]             ` <719a19c4-3be5-2260-7349-b3f1bb774f4f-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2023-07-31 23:47               ` Tejun Heo
     [not found]                 ` <ZMhIFUsxEtA_B781-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2023-08-01  7:48                   ` Miaohe Lin
     [not found]                     ` <3ec1f5d9-4887-4583-a973-92298a9bc924-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2023-08-02 19:39                       ` Tejun Heo
     [not found]                         ` <ZMqxCVOkU7pKK9OO-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2023-08-03  1:38                           ` Miaohe Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox