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: <20140825094140.GA11611@krava.brq.redhat.com>
Date:	Mon, 25 Aug 2014 11:41:41 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:	linux-kernel@...r.kernel.org,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
	David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...nel.org>,
	Jean Pihet <jean.pihet@...aro.org>,
	Jiri Olsa <jolsa@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>,
	Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [PATCH 06/10] perf evlist: Allow growing pollfd on add method

On Fri, Aug 22, 2014 at 05:59:46PM -0300, Arnaldo Carvalho de Melo wrote:

SNIP

> -void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd)
> +int perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd)
>  {
> +	/*
> +	 * XXX: 64 is arbitrary, just not to call realloc at each fd.
> +	 *	Find a better autogrowing heuristic
> +	 */
> +	if (evlist->nr_fds == evlist->nr_fds_alloc &&
> +	    perf_evlist__grow_pollfd(evlist, 64) < 0)
> +		return -ENOMEM;
> +
>  	fcntl(fd, F_SETFL, O_NONBLOCK);
>  	evlist->pollfd[evlist->nr_fds].fd = fd;
>  	evlist->pollfd[evlist->nr_fds].events = POLLIN | POLLERR | POLLHUP;
>  	evlist->nr_fds++;
> +	return 0;
>  }
>  
>  int perf_evlist__filter_pollfd(struct perf_evlist *evlist, short revents_and_mask)
> @@ -713,7 +739,11 @@ static int __perf_evlist__mmap(struct perf_evlist *evlist, int idx,
>  		return -1;
>  	}
>  
> -	perf_evlist__add_pollfd(evlist, fd);
> +	if (perf_evlist__add_pollfd(evlist, fd) < 0) {
> +		__perf_evlist__munmap(evlist->mmap[idx].base, idx);

unmap does not look necessary here.. should be handeled by out_unmap
in both perf_evlist__mmap_per_thread and perf_evlist__mmap_per_cpu

jirka
--
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