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:	Mon, 20 Sep 2010 15:04:39 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Ben Hutchings <bhutchings@...arflare.com>
Cc:	"Michael S. Tsirkin" <mst@...hat.com>,
	David Miller <davem@...emloft.net>, therbert@...gle.com,
	shemminger@...tta.com, netdev@...r.kernel.org
Subject: Re: [RFC][PATCH 1/3] IRQ: Add irq_get_numa_node()

Le lundi 20 septembre 2010 à 13:44 +0100, Ben Hutchings a écrit :
> This will be used to support NUMA-aware memory allocation of
> structures used in interrupt handlers, starting with network drivers.
> ---
> irq_get_numa_node() probably needs to grab desc->lock.  Other than that,
> this should work.
> 
> Ben.
> 
>  include/linux/interrupt.h |    9 +++++++++
>  kernel/irq/manage.c       |   35 +++++++++++++++++++++++++++++++++++
>  2 files changed, 44 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
> index a0384a4..82e9a08 100644
> --- a/include/linux/interrupt.h
> +++ b/include/linux/interrupt.h
> @@ -260,6 +260,15 @@ static inline int irq_set_affinity_hint(unsigned int irq,
>  }
>  #endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */
>  
> +#if defined(CONFIG_NUMA) && defined(CONFIG_GENERIC_HARDIRQS)
> +extern int irq_get_numa_node(unsigned int irq);
> +#else
> +static inline int irq_get_numa_node(unsigned int irq)
> +{
> +	return -1;
> +}
> +#endif
> +
>  #ifdef CONFIG_GENERIC_HARDIRQS
>  /*
>   * Special lockdep variants of irq disabling/enabling.
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index c3003e9..03e683e 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -154,6 +154,41 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
>  }
>  EXPORT_SYMBOL_GPL(irq_set_affinity_hint);
>  
> +#ifdef CONFIG_NUMA
> +/**
> + *	irq_get_numa_node - get the NUMA node of a given IRQ
> + *	@irq:		Interrupt to get NUMA node for
> + *
> + *	If the current SMP affinity mask of the IRQ corresponds to a
> + *	single NUMA node, return the node number.  Otherwise return
> + *	%NUMA_NO_NODE.
> + */
> +int irq_get_numa_node(unsigned int irq)
> +{
> +	struct irq_desc *desc = irq_to_desc(irq);
> +	const struct cpumask *mask;
> +	int cpu, node = NUMA_NO_NODE;
> +
> +	if (!desc)
> +		return node;
> +
> +	mask = desc->affinity;
> +#ifdef CONFIG_GENERIC_PENDING_IRQ
> +	if (desc->status & IRQ_MOVE_PENDING)
> +		mask = desc->pending_mask;
> +#endif
> +
> +	for_each_cpu(cpu, mask) {
> +		if (node < 0)

or : if (node == NUMA_NO_NODE)

> +			node = cpu_to_node(cpu);
> +		else if (node != cpu_to_node(cpu))
> +			return NUMA_NO_NODE;
> +	}
> +
> +	return node;
> +}
> +#endif
> +
>  #ifndef CONFIG_AUTO_IRQ_AFFINITY
>  /*
>   * Generic version of the affinity autoselector.
> -- 
> 1.7.2.1
> 
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ