Re: [PATCH v2 1/2] trace-cmd: Fix crash when trace-cmd is executed with args "profile -F sleep 1"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed,  5 Jun 2019 14:19:36 +0300
Tzvetomir Stoyanov <tstoyanov@xxxxxxxxxx> wrote:

> @@ -973,6 +984,17 @@ static void __free_page(struct tracecmd_input *handle, struct page *page)
>  	cpu_data->page_cnt--;
>  
>  	free(page);
> +
> +	for (index = cpu_data->nr_pages - 1; index > 0; index--)
> +		if (cpu_data->pages[index])
> +			break;
> +	if (index < (cpu_data->nr_pages - 1)) {
> +		pages = realloc(cpu_data->pages, (index + 1) * sizeof(*cpu_data->pages));
> +		if (!pages)
> +			return;
> +		cpu_data->pages = pages;
> +		cpu_data->nr_pages = index + 1;
> +	}
>  }
>  

Heads up. Johannes found a regression that this code above causes
reading a 1.7G file where the above code makes it go from reading it in
5 seconds, to over 2 minutes!

I bisected it down to this commit (saw a small, but not so drastic
performance issue it my tests). I asked Johannes to revert the commit,
and he said that it removed the regression.

He said he'll report this in the Bugzilla, but we should be looking at
changing the realloc() logic.

-- Steve



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux