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]
Message-ID: <ZWYYrJVMUOrl9r2g@slm.duckdns.org>
Date:   Tue, 28 Nov 2023 06:43:38 -1000
From:   Tejun Heo <tj@...nel.org>
To:     Waiman Long <longman@...hat.com>
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 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?

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ