linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cgroup: return early if it is already on preloaded list
@ 2021-12-11 16:17 Wei Yang
  2021-12-13 19:27 ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yang @ 2021-12-11 16:17 UTC (permalink / raw)
  To: tj, lizefan.x, hannes; +Cc: cgroups, linux-kernel, Wei Yang

If it is already on preloaded list, this means we have already setup
this cset properly for migration.

Let's skip this cset on this condition.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 kernel/cgroup/cgroup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 452a723d4a36..2cf729afe834 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2648,11 +2648,11 @@ void cgroup_migrate_add_src(struct css_set *src_cset,
 	if (src_cset->dead)
 		return;
 
-	src_cgrp = cset_cgroup_from_root(src_cset, dst_cgrp->root);
-
 	if (!list_empty(&src_cset->mg_preload_node))
 		return;
 
+	src_cgrp = cset_cgroup_from_root(src_cset, dst_cgrp->root);
+
 	WARN_ON(src_cset->mg_src_cgrp);
 	WARN_ON(src_cset->mg_dst_cgrp);
 	WARN_ON(!list_empty(&src_cset->mg_tasks));
-- 
2.33.1


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

* Re: [PATCH] cgroup: return early if it is already on preloaded list
  2021-12-11 16:17 [PATCH] cgroup: return early if it is already on preloaded list Wei Yang
@ 2021-12-13 19:27 ` Tejun Heo
  2021-12-14  0:36   ` Wei Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2021-12-13 19:27 UTC (permalink / raw)
  To: Wei Yang; +Cc: lizefan.x, hannes, cgroups, linux-kernel

On Sat, Dec 11, 2021 at 04:17:29PM +0000, Wei Yang wrote:
> If it is already on preloaded list, this means we have already setup
> this cset properly for migration.
> 
> Let's skip this cset on this condition.

The patch looks fine but I think description can be improved. Can you just
say that it's just relocating the root cgrp lookup which isn't used anyway
when the cset is already on the preloaded list?

Thanks.

-- 
tejun

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

* Re: [PATCH] cgroup: return early if it is already on preloaded list
  2021-12-13 19:27 ` Tejun Heo
@ 2021-12-14  0:36   ` Wei Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Yang @ 2021-12-14  0:36 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Wei Yang, lizefan.x, hannes, cgroups, linux-kernel

On Mon, Dec 13, 2021 at 09:27:12AM -1000, Tejun Heo wrote:
>On Sat, Dec 11, 2021 at 04:17:29PM +0000, Wei Yang wrote:
>> If it is already on preloaded list, this means we have already setup
>> this cset properly for migration.
>> 
>> Let's skip this cset on this condition.
>
>The patch looks fine but I think description can be improved. Can you just
>say that it's just relocating the root cgrp lookup which isn't used anyway
>when the cset is already on the preloaded list?
>

Sure, let me try to rephrase it :-)

>Thanks.
>
>-- 
>tejun

-- 
Wei Yang
Help you, Help me

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

end of thread, other threads:[~2021-12-14  0:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-11 16:17 [PATCH] cgroup: return early if it is already on preloaded list Wei Yang
2021-12-13 19:27 ` Tejun Heo
2021-12-14  0:36   ` Wei Yang

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).