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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to