lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 10 Jul 2023 17:11:00 +0200
From:   Michal Koutný <mkoutny@...e.com>
To:     Miaohe Lin <linmiaohe@...wei.com>
Cc:     longman@...hat.com, tj@...nel.org, hannes@...xchg.org,
        lizefan.x@...edance.com, cgroups@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cgroup/cpuset: update parent subparts cpumask while
 holding css refcnt

Hello.

On Sat, Jul 01, 2023 at 02:50:49PM +0800, Miaohe Lin <linmiaohe@...wei.com> wrote:
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -1806,9 +1806,12 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
>  		cpuset_for_each_child(cp, css, parent)
>  			if (is_partition_valid(cp) &&
>  			    cpumask_intersects(trialcs->cpus_allowed, cp->cpus_allowed)) {
> +				if (!css_tryget_online(&cp->css))
> +					continue;
>  				rcu_read_unlock();
>  				update_parent_subparts_cpumask(cp, partcmd_invalidate, NULL, &tmp);
>  				rcu_read_lock();
> +				css_put(&cp->css);

Apologies for a possibly noob question -- why is RCU read lock
temporarily dropped within the loop?
(Is it only because of callback_lock or cgroup_file_kn_lock (via
notify_partition_change()) on PREEMPT_RT?)



[
OT question:
	cpuset_for_each_child(cp, css, parent)				(1)
		if (is_partition_valid(cp) &&
		    cpumask_intersects(trialcs->cpus_allowed, cp->cpus_allowed)) {
			if (!css_tryget_online(&cp->css))
				continue;
			rcu_read_unlock();
			update_parent_subparts_cpumask(cp, partcmd_invalidate, NULL, &tmp);
			  ...
			  update_tasks_cpumask(cp->parent)
			    ...
			    css_task_iter_start(&cp->parent->css, 0, &it);	(2)
			      ...
			rcu_read_lock();
			css_put(&cp->css);
		}

May this touch each task same number of times as its depth within
herarchy?
]

Thanks,
Michal

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ