Subject: Re: [PATCH 1/7] powerpc: Reduce footprint of irq_stat

From: Christoph Hellwig <[email-masked]>
Date: Mon, 1 Feb 2010 22:55:04 +0100

On Mon, Feb 01, 2010 at 05:30:23PM +1100, Anton Blanchard wrote:
> 
> PowerPC is currently using asm-generic/hardirq.h which statically allocates an
> NR_CPUS irq_stat array. Switch to an arch specific implementation which uses
> per cpu data:
> 
> On a kernel with NR_CPUS=1024, this saves quite a lot of memory:
> 
>    text    data     bss      dec         hex    filename
> 8767938 2944132 1636796 13348866         cbb002 vmlinux.baseline
> 8767779 2944260 1505724 13217763         c9afe3 vmlinux.irq_cpustat
> 
> A saving of around 128kB.
> 
> Signed-off-by: Anton Blanchard <[email-masked]>
> ---
> 
> Index: linux-cpumask/arch/powerpc/include/asm/hardirq.h
> ===================================================================
> --- linux-cpumask.orig/arch/powerpc/include/asm/hardirq.h	2010-01-31 22:07:21.037211728 +1100
> +++ linux-cpumask/arch/powerpc/include/asm/hardirq.h	2010-02-01 17:28:56.990963256 +1100
> @@ -1 +1,22 @@
> -#include <asm-generic/hardirq.h>
> +#ifndef _ASM_POWERPC_HARDIRQ_H
> +#define _ASM_POWERPC_HARDIRQ_H
> +
> +#include <linux/threads.h>
> +#include <linux/irq.h>
> +
> +typedef struct {
> +	unsigned int __softirq_pending;
> +} ____cacheline_aligned irq_cpustat_t;

No need to bother with an irq_cpustat_t type at all in this case, just
declare a softirq_pending per-cpu variable.