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-next>] [day] [month] [year] [list]
Date:	Wed, 27 Nov 2013 17:23:04 -0500
From:	Dongsheng Yang <yangds.fnst@...fujitsu.com>
To:	linux-kernel@...r.kernel.org
Cc:	dsahern@...il.com, adrian.hunter@...el.com, jolsa@...hat.com,
	namhyung@...nel.org, acme@...stprotocols.net, mingo@...hat.com,
	Dongsheng Yang <yangds.fnst@...fujitsu.com>
Subject: [PATCH] perf util: Join four conditions in two in perf_evlist__create_maps().

There are four condition branchs in perf_evlist__create_maps, but they
only do two kinds of thing. 1st and 4th call cpu_map__new(), and the others
call cpu_map__dummy_new(). This patch joins them in two branchs, decreasing
the number of branch and removing some duplicated code.

Signed-off-by: Dongsheng Yang <yangds.fnst@...fujitsu.com>
---
 tools/perf/util/evlist.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index bbc746a..2258eb4 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -819,11 +819,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
 	if (evlist->threads == NULL)
 		return -1;
 
-	if (target->force_per_cpu)
-		evlist->cpus = cpu_map__new(target->cpu_list);
-	else if (target__has_task(target))
-		evlist->cpus = cpu_map__dummy_new();
-	else if (!target__has_cpu(target) && !target->uses_mmap)
+	if (!target->force_per_cpu &&
+	    (target__has_task(target) || 
+	     (!target__has_cpu(target) && !target->uses_mmap)))
 		evlist->cpus = cpu_map__dummy_new();
 	else
 		evlist->cpus = cpu_map__new(target->cpu_list);
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ