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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 22 Feb 2007 08:56:23 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Eric Dumazet <dada1@...mosbay.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Speedup divides by cpu_power in scheduler


* Eric Dumazet <dada1@...mosbay.com> wrote:

> I noticed expensive divides done in try_to_wakeup() and 
> find_busiest_group() on a bi dual core Opteron machine (total of 4 
> cores), moderatly loaded (15.000 context switch per second)
> 
> oprofile numbers :

nice patch! Ack for -mm testing:

Acked-by: Ingo Molnar <mingo@...e.hu>

one general suggestion: could you rename ->cpu_power to ->__cpu_power? 
That makes it perfectly clear that this field's semantics have changed 
and that it should never be manipulated directly without also changing 
->reciprocal_cpu_power, and will also flag any out of tree code 
trivially.

> + * Divide a load by a sched group cpu_power : (load / sg->cpu_power)
> + * Since cpu_power is a 'constant', we can use a reciprocal divide.
> + */
> +static inline u32 sg_div_cpu_power(const struct sched_group *sg, u32 load)
> +{
> +	return reciprocal_divide(load, sg->reciprocal_cpu_power);
> +}
> +/*
> + * Each time a sched group cpu_power is changed,
> + * we must compute its reciprocal value
> + */
> +static inline void sg_inc_cpu_power(struct sched_group *sg, u32 val)
> +{
> +	sg->cpu_power += val;
> +	BUG_ON(sg->cpu_power == 0);
> +	sg->reciprocal_cpu_power = reciprocal_value(sg->cpu_power);
> +}

Could you remove the BUG_ON() - it will most likely cause the 
non-inlining of these functions if CONFIG_CC_OPTIMIZE_FOR_SIZE=y and 
CONFIG_FORCED_INLINING is disabled (which is a popular combination in 
distro kernels, it reduces the kernel's size by over 30%). And it's not 
like we'll be able to overlook a divide by zero crash in 
reciprocal_value() anyway, if cpu_power were to be zero ;-)

	Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ