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] [day] [month] [year] [list]
Message-ID: <708eda13-6615-4efe-87e1-f3610e90e116@redhat.com>
Date:   Tue, 28 Nov 2023 11:46:18 -0500
From:   Waiman Long <longman@...hat.com>
To:     Tejun Heo <tj@...nel.org>
Cc:     Zefan Li <lizefan.x@...edance.com>,
        Johannes Weiner <hannes@...xchg.org>, cgroups@...r.kernel.org,
        linux-kernel@...r.kernel.org, Joe Mario <jmario@...hat.com>,
        Sebastian Jug <sejug@...hat.com>,
        Yosry Ahmed <yosryahmed@...gle.com>
Subject: Re: [PATCH v4 2/3] cgroup/rstat: Optimize cgroup_rstat_updated_list()

On 11/28/23 11:43, Tejun Heo wrote:
> On Mon, Nov 27, 2023 at 11:01:22PM -0500, Waiman Long wrote:
> ...
>>> + * Recursively traverse down the cgroup_rstat_cpu updated tree and push
>>> + * parent first before its children into a singly linked list built from
>>> + * the tail backward like "pushing" cgroups into a stack. The parent is
>>> + * pushed by the caller. The recursion depth is the depth of the current
>>> + * updated subtree.
>>> + */
>>> +static struct cgroup *cgroup_rstat_push_children(struct cgroup *head,
>>> +				struct cgroup_rstat_cpu *prstatc, int cpu)
>>> +{
>>> +	struct cgroup *child, *parent;
>>> +	struct cgroup_rstat_cpu *crstatc;
>>> +
>>> +	parent = head;
>>> +	child = prstatc->updated_children;
>>> +	prstatc->updated_children = parent;
>>> +
>>> +	/* updated_next is parent cgroup terminated */
>>> +	while (child != parent) {
>>> +		child->rstat_flush_next = head;
>>> +		head = child;
>>> +		crstatc = cgroup_rstat_cpu(child, cpu);
>>> +		if (crstatc->updated_children != child)
>>> +			head = cgroup_rstat_push_children(head, crstatc, cpu);
>>> +		child = crstatc->updated_next;
>>> +		crstatc->updated_next = NULL;
>>> +	}
>>> +	return head;
> The recursion bothers me. We don't really have a hard limit on nesting
> depth. We might need to add another pointer field but can make this
> iterative, right?

I see. Yes, I think it is possible to make it iterative. Using recursion 
is just an easier way to do it. Will look into that.

Thanks,
Longman

>
> Thanks.
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ