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] [day] [month] [year] [list]
Message-ID: <b8e461e9-e835-539b-119a-698e774194af@linux.intel.com>
Date:   Wed, 26 Jun 2019 08:57:30 +0800
From:   "Jin, Yao" <yao.jin@...ux.intel.com>
To:     Jiri Olsa <jolsa@...hat.com>
Cc:     acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
        mingo@...hat.com, alexander.shishkin@...ux.intel.com,
        Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
        kan.liang@...el.com, yao.jin@...el.com
Subject: Re: [PATCH v4 4/7] perf diff: Use hists to manage basic blocks per
 symbol



On 6/25/2019 5:11 PM, Jiri Olsa wrote:
> On Thu, Jun 20, 2019 at 10:36:39PM +0800, Jin Yao wrote:
> 
> SNIP
> 
>> +
>> +static void *block_entry_zalloc(size_t size)
>> +{
>> +	return zalloc(size + sizeof(struct hist_entry));
>> +}
>> +
>> +static void block_entry_free(void *he)
>> +{
>> +	struct block_info *bi = ((struct hist_entry *)he)->block_info;
>> +
>> +	block_info__put(bi);
>> +	free(he);
>> +}
> 
> so if we carry block_info in 'struct hist_entry' we don't need
> to use our own allocation in the 2nd level hist entries.. just
> for the first level to carry the new 'struct block_hists'
> 
> the block_info should be released in hist_entry__delete then,
> same as for other *info pointers
> 
> the rest of the patchset looks ok to me
> 
> thanks,
> jirka
> 

Yes, releasing the block_info in hist_entry__delete is a better way. 
Thanks Jiri, I will update the patch.

Thanks
Jin Yao

>> +
>> +struct hist_entry_ops block_entry_ops = {
>> +	.new    = block_entry_zalloc,
>> +	.free   = block_entry_free,
>> +};
>> +
>> +static int process_block_per_sym(struct hist_entry *he)
>> +{
>> +	struct annotation *notes;
>> +	struct cyc_hist *ch;
>> +	struct block_hist *bh;
>> +
>> +	if (!he->ms.map || !he->ms.sym)
>> +		return 0;
>> +
>> +	notes = symbol__annotation(he->ms.sym);
>> +	if (!notes || !notes->src || !notes->src->cycles_hist)
>> +		return 0;
>> +
>> +	bh = container_of(he, struct block_hist, he);
>> +	init_block_hist(bh);
>> +
>> +	ch = notes->src->cycles_hist;
>> +	for (unsigned int i = 0; i < symbol__size(he->ms.sym); i++) {
>> +		if (ch[i].num_aggr) {
>> +			struct block_info *bi;
>> +			struct hist_entry *he_block;
>> +
>> +			bi = block_info__new();
>> +			if (!bi)
>> +				return -1;
>> +
>> +			init_block_info(bi, he->ms.sym, &ch[i], i);
>> +			he_block = hists__add_entry_block(&bh->block_hists,
>> +							  &block_entry_ops,
>> +							  &dummy_al, bi);
>> +			if (!he_block) {
>> +				block_info__put(bi);
>> +				return -1;
>> +			}
>> +		}
>> +	}
>> +
>> +	return 0;
> 
> SNIP
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ