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: <20190708153855.GC3419@hirez.programming.kicks-ass.net>
Date:   Mon, 8 Jul 2019 17:38:55 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        linux-kernel@...r.kernel.org,
        Kan Liang <kan.liang@...ux.intel.com>,
        Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 2/7] perf/cgroup: order events in RB tree by cgroup id

On Mon, Jul 01, 2019 at 11:59:50PM -0700, Ian Rogers wrote:
> @@ -1530,6 +1530,32 @@ perf_event_groups_less(struct perf_event *left, struct perf_event *right)
>  	if (left->cpu > right->cpu)
>  		return false;
>  
> +#ifdef CONFIG_CGROUP_PERF
> +	if (left->cgrp != right->cgrp) {
> +		if (!left->cgrp)
> +			/*
> +			 * Left has no cgroup but right does, no cgroups come
> +			 * first.
> +			 */
> +			return true;
> +		if (!right->cgrp)
> +			/*
> +			 * Right has no cgroup but left does, no cgroups come
> +			 * first.
> +			 */
> +			return false;

Per CodingStyle any multi-line statement (here due to comments) needs {
}.

> +		if (left->cgrp->css.cgroup != right->cgrp->css.cgroup) {
> +			if (!left->cgrp->css.cgroup)
> +				return true;
> +			if (!right->cgrp->css.cgroup)
> +				return false;
> +			/* Two dissimilar cgroups, order by id. */
> +			return left->cgrp->css.cgroup->id <
> +					right->cgrp->css.cgroup->id;
> +		}

This is dis-similar to the existing style ( < true, > false, ==
fall-through).

Can all this be written like:


	if (!left->cgrp || !left->cgrp.css.cgroup)
		return true;

	if (!right->cgrp || !right->cgrp.css.cgroup)
		return false;

	if (left->cgrp->css.cgroup->id < right->cgrp->css.cgroup->id)
		retun true;

	if (left->cgrp->css.cgroup->id > right->cgrp->css.cgroup->id)
		return false;


?

> +	}
> +#endif
> +
>  	if (left->group_index < right->group_index)
>  		return true;
>  	if (left->group_index > right->group_index)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ