netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Amir Vadai <amirv@mellanox.com>, "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Yevgeny Petrilin <yevgenyp@mellanox.com>,
	Or Gerlitz <ogerlitz@mellanox.com>,
	Prarit Bhargava <prarit@redhat.com>,
	Govindarajulu Varadarajan <gvaradar@cisco.com>
Subject: Re: [PATCH net-next V2 1/2] net: Utility function to get affinity_hint by policy
Date: Wed, 05 Mar 2014 18:42:30 +0400	[thread overview]
Message-ID: <531737D6.6070604@cogentembedded.com> (raw)
In-Reply-To: <1394014159-18801-2-git-send-email-amirv@mellanox.com>

Hello.

On 05-03-2014 14:09, Amir Vadai wrote:

> This function sets the affinity_mask according to a numa aware policy.
> affinity_mask could be used as an affinity hint for the IRQ related to
> this rx queue.
> Current policy is to spread rx queues accross cores - local cores first.
> It could be extended in the future.

> CC: Prarit Bhargava <prarit@redhat.com>
> CC: Govindarajulu Varadarajan <gvaradar@cisco.com>
> Signed-off-by: Amir Vadai <amirv@mellanox.com>
[...]

> diff --git a/net/core/dev.c b/net/core/dev.c
> index b1b0c8d..0b22f67 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -2116,6 +2116,62 @@ int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq)
>   EXPORT_SYMBOL(netif_set_real_num_rx_queues);
>   #endif
>
> +/* netif_set_rx_queue_affinity_hint - set affinity hint of rx queue

    This should be a comment in the kernel-doc style, starting with /** on a 
line of its own.

> + * @rxq: index of rx queue
> + * @numa_node: prefered numa_node
> + * @affinity_mask: the relevant cpu bit is set according to the policy
> + *
> + * This function sets the affinity_mask according to a numa aware policy.
> + * affinity_mask coulbe used as an affinity hint for the IRQ related to this
> + * rx queue.
> + * The policy is to spread rx queues accross cores - local cores first.
> + *
> + * Returns 0 on success, or a negative error code.
> + */
> +int netif_set_rx_queue_affinity_hint(int rxq, int numa_node,
> +				     cpumask_var_t affinity_mask)
> +{
> +	const struct cpumask *p_numa_cores_mask;
> +	cpumask_var_t non_numa_cores_mask = NULL;
> +	int affinity_cpu;
> +	int ret = 0;
> +
> +	rxq = rxq % num_online_cpus();

    Why not:

	rxq %= num_online_cpus();

WBR, Sergei

  reply	other threads:[~2014-03-05 14:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05 10:09 [PATCH net-next V2 0/2] net: Affinity hint helper function Amir Vadai
2014-03-05 10:09 ` [PATCH net-next V2 1/2] net: Utility function to get affinity_hint by policy Amir Vadai
2014-03-05 14:42   ` Sergei Shtylyov [this message]
2014-03-05 10:09 ` [PATCH net-next V2 2/2] net/mlx4_en: Use affinity hint Amir Vadai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=531737D6.6070604@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=amirv@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=gvaradar@cisco.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=prarit@redhat.com \
    --cc=yevgenyp@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).