Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1559763

Re: [PATCH 5/8] x86/intel_rct/mba: Add MBA structures and initialize MBA

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH 5/8] x86/intel_rct/mba: Add MBA structures and initialize MBA
Date 2017-01-16 15:10 +0100
Message-ID <t0g8W-1qX-3@gated-at.bofh.it> (permalink)
References <sYaqZ-5m6-3@gated-at.bofh.it> <sYar1-5m6-57@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 10 Jan 2017, Vikas Shivappa wrote:
> +static void rdt_get_mem_config(struct rdt_resource *r)
> +{
> +	union cpuid_0x10_3_eax eax;
> +	union cpuid_0x10_x_edx edx;
> +	u32 ebx, ecx;
> +
> +	cpuid_count(0x00000010, 3, &eax.full, &ebx, &ecx, &edx.full);
> +	r->num_closid = edx.split.cos_max + 1;
> +	r->max_delay = eax.split.max_delay + 1;
> +	r->no_ctrl = 0;
> +	if (ecx & MBE_IS_LINEAR)
> +		r->delay_linear = true;
> +
> +	if (r->delay_linear)
> +		r->delay_gran = MAX_MBA_THRTL - r->max_delay;

What's the point of this extra conditional?

	if (ecx & MBE_IS_LINEAR) {
		r->delay_linear = true;
		r->delay_gran = MAX_MBA_THRTL - r->max_delay;
	}	

would be too obvious and easy to understand, right?

> +static int domain_setup_ctrlval(struct rdt_resource *r, struct rdt_domain *d)
> +{
> +	int i;
> +
> +	d->ctrl_val = kmalloc_array(r->num_closid,
> +				     sizeof(*d->ctrl_val), GFP_KERNEL);
> +	if (!d->ctrl_val) {
> +		kfree(d);

Freeing memory in the error path of some other random function is just wrong.

	if (!d->ctrl_val)
		return -ENOMEM;

and deal with the fallout at the calling function.

Thanks,

	tglx

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/8 V1] x86/intel_rdt: Memory b/w Allocation support Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-01-10 20:40 +0100
  [PATCH 7/8] x86/intel_rdt/mba: Add schemata file support for MBA Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-01-10 20:40 +0100
    Re: [PATCH 7/8] x86/intel_rdt/mba: Add schemata file support for  MBA Thomas Gleixner <tglx@linutronix.de> - 2017-01-16 17:10 +0100
      Re: [PATCH 7/8] x86/intel_rdt/mba: Add schemata file support for  MBA Shivappa Vikas <vikas.shivappa@intel.com> - 2017-01-18 02:10 +0100
  [PATCH 5/8] x86/intel_rct/mba: Add MBA structures and initialize MBA Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-01-10 20:40 +0100
    Re: [PATCH 5/8] x86/intel_rct/mba: Add MBA structures and initialize  MBA Thomas Gleixner <tglx@linutronix.de> - 2017-01-16 15:10 +0100
      Re: [PATCH 5/8] x86/intel_rct/mba: Add MBA structures and initialize  MBA Shivappa Vikas <vikas.shivappa@intel.com> - 2017-01-18 02:00 +0100
  [PATCH 8/8] x86/intel_rdt: rmdir,umount and hotcpu updates for MBA Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-01-10 20:40 +0100
    Re: [PATCH 8/8] x86/intel_rdt: rmdir,umount and hotcpu updates for  MBA Thomas Gleixner <tglx@linutronix.de> - 2017-01-16 17:20 +0100
      Re: [PATCH 8/8] x86/intel_rdt: rmdir,umount and hotcpu updates for  MBA Shivappa Vikas <vikas.shivappa@intel.com> - 2017-01-23 21:20 +0100

csiph-web