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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <74b13a0d-9f49-4a5d-8554-3e68be7cca88@amd.com>
Date: Wed, 12 Nov 2025 12:20:31 +0530
From: K Prateek Nayak <kprateek.nayak@....com>
To: Wanpeng Li <kernellwp@...il.com>, Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>, Thomas Gleixner <tglx@...utronix.de>, "Paolo
 Bonzini" <pbonzini@...hat.com>, Sean Christopherson <seanjc@...gle.com>
CC: Steven Rostedt <rostedt@...dmis.org>, Vincent Guittot
	<vincent.guittot@...aro.org>, Juri Lelli <juri.lelli@...hat.com>,
	<linux-kernel@...r.kernel.org>, <kvm@...r.kernel.org>, Wanpeng Li
	<wanpengli@...cent.com>
Subject: Re: [PATCH 03/10] sched/fair: Add cgroup LCA finder for hierarchical
 yield

Hello Wanpeng,

On 11/10/2025 9:02 AM, Wanpeng Li wrote:
> +/*
> + * Find the lowest common ancestor (LCA) in the cgroup hierarchy for EEVDF.
> + * We walk up both entity hierarchies under rq->lock protection.
> + * Task migration requires task_rq_lock, ensuring parent chains remain stable.
> + * We locate the first common cfs_rq where both entities coexist, representing
> + * the appropriate level for vruntime adjustments and EEVDF field updates
> + * (deadline, vlag) to maintain scheduler consistency.
> + */
> +static bool __maybe_unused yield_deboost_find_lca(struct sched_entity *se_y, struct sched_entity *se_t,
> +				    struct sched_entity **se_y_lca_out,
> +				    struct sched_entity **se_t_lca_out,
> +				    struct cfs_rq **cfs_rq_common_out)
> +{
> +	struct sched_entity *se_y_lca, *se_t_lca;
> +	struct cfs_rq *cfs_rq_common;
> +
> +#ifdef CONFIG_FAIR_GROUP_SCHED
> +	se_t_lca = se_t;
> +	se_y_lca = se_y;
> +
> +	while (se_t_lca && se_y_lca && se_t_lca->depth != se_y_lca->depth) {
> +		if (se_t_lca->depth > se_y_lca->depth)
> +			se_t_lca = se_t_lca->parent;
> +		else
> +			se_y_lca = se_y_lca->parent;
> +	}
> +
> +	while (se_t_lca && se_y_lca) {
> +		if (cfs_rq_of(se_t_lca) == cfs_rq_of(se_y_lca)) {
> +			cfs_rq_common = cfs_rq_of(se_t_lca);
> +			goto found_lca;
> +		}
> +		se_t_lca = se_t_lca->parent;
> +		se_y_lca = se_y_lca->parent;
> +	}
> +	return false;
> +#else
> +	if (cfs_rq_of(se_y) != cfs_rq_of(se_t))
> +		return false;
> +	cfs_rq_common = cfs_rq_of(se_y);
> +	se_y_lca = se_y;
> +	se_t_lca = se_t;
> +#endif
> +
> +found_lca:
> +	if (!se_y_lca || !se_t_lca)
> +		return false;

Can that even happen? They should meet at the root cfs_rq.
Also all of this seems to be just find_matching_se() from
fair.c. Can't we just reuse that?

> +
> +	if (cfs_rq_common->nr_queued <= 1)
> +		return false;
> +
> +	if (!se_y_lca->slice)
> +		return false;

Is that even possible?

> +
> +	*se_y_lca_out = se_y_lca;
> +	*se_t_lca_out = se_t_lca;
> +	*cfs_rq_common_out = cfs_rq_common;

Again, find_matching_se() does pretty much similar thing
and you can just use cfs_rq_of(se) to get the common cfs_rq.

> +	return true;
> +}
> +
>  /*
>   * sched_yield() is very simple
>   */

-- 
Thanks and Regards,
Prateek


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ