[no subject]

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

 



...

>>> +static int mbm_cntr_get(struct rdt_resource *r, struct rdt_mon_domain *d,
>>> +			struct rdtgroup *rdtgrp, enum resctrl_event_id evtid)
>>> +{
>>> +	int cntr_id;
>>> +
>>> +	for (cntr_id = 0; cntr_id < r->mon.num_mbm_cntrs; cntr_id++) {
>>> +		if (d->cntr_cfg[cntr_id].rdtgrp == rdtgrp &&
>>> +		    d->cntr_cfg[cntr_id].evtid == evtid)
>>> +			return cntr_id;
>>> +	}
>>> +
>>> +	return -ENOENT;
>>> +}
>>> +
>>> +static int mbm_cntr_alloc(struct rdt_resource *r, struct rdt_mon_domain *d,
>>> +			  struct rdtgroup *rdtgrp, enum resctrl_event_id evtid)
>>> +{
>>> +	int cntr_id;
>>> +
>>> +	for (cntr_id = 0; cntr_id < r->mon.num_mbm_cntrs; cntr_id++) {
>>> +		if (!d->cntr_cfg[cntr_id].rdtgrp) {
>>> +			d->cntr_cfg[cntr_id].rdtgrp = rdtgrp;
>>> +			d->cntr_cfg[cntr_id].evtid = evtid;
>>> +			return cntr_id;
>>> +		}
>>> +	}
>>> +
>>> +	return -ENOSPC;
>>> +}
>>> +
>>> +static void mbm_cntr_free(struct rdt_mon_domain *d, int cntr_id)
>>> +{
>>> +	memset(&d->cntr_cfg[cntr_id], 0, sizeof(struct mbm_cntr_cfg));
>>> +}
>>> +
>>> +/*
>>> + * Allocate a fresh counter and configure the event if not assigned already.
>>> + */
>>> +static int resctrl_alloc_config_cntr(struct rdt_resource *r, struct rdt_mon_domain *d,
>>> +				     struct rdtgroup *rdtgrp, enum resctrl_event_id evtid,
>>> +				     u32 evt_cfg)
>>
>> Same here, why are both evtid and evt_cfg provided as arguments? 
> 
> Yes. It can be done. Then I have to export the functions like
> mbm_get_assign_config() into monitor.c. To avoid that I passed it from
> here which I felt much more cleaner.

Maybe even resctrl_assign_cntr_event() does not need to call mbm_get_assign_config()
but only resctrl_alloc_config_cntr() needs to call mbm_get_assign_config(). Doing so
may avoid more burden on callers while reducing parameters needed throughout.

Reinette




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux