From: David Miller <davem@davemloft.net>
To: amirv@mellanox.com
Cc: netdev@vger.kernel.org, yevgenyp@mellanox.com,
ogerlitz@mellanox.com, prarit@redhat.com, gvaradar@cisco.com
Subject: Re: [PATCH net-next V3 1/2] net: Utility function to get affinity_hint by policy
Date: Thu, 06 Mar 2014 15:38:35 -0500 (EST) [thread overview]
Message-ID: <20140306.153835.2248996436618700806.davem@davemloft.net> (raw)
In-Reply-To: <1394126332-11110-2-git-send-email-amirv@mellanox.com>
From: Amir Vadai <amirv@mellanox.com>
Date: Thu, 6 Mar 2014 19:18:51 +0200
> + rxq %= num_online_cpus();
> +
> + p_numa_cores_mask = cpumask_of_node(numa_node);
> + if (!p_numa_cores_mask)
> + p_numa_cores_mask = cpu_online_mask;
> +
> + for_each_cpu(affinity_cpu, p_numa_cores_mask) {
> + if (--rxq < 0)
> + goto out;
> + }
> +
> + if (!zalloc_cpumask_var(&non_numa_cores_mask, GFP_KERNEL)) {
> + ret = -ENOMEM;
> + goto err;
> + }
> +
> + cpumask_xor(non_numa_cores_mask, cpu_online_mask, p_numa_cores_mask);
> +
> + for_each_cpu(affinity_cpu, non_numa_cores_mask) {
> + if (--rxq < 0)
> + goto out;
> + }
> +
> + ret = -EINVAL;
> + goto err;
The NUMA core mask and the non-NUMA core mask must together provide
at least num_online_cpus() bits.
Said another way, since rxq is limited to num_online_cpus() it should
never exceed local + non-local cores.
Therefore this -EINVAL path seems like it should not be possible, and
therefore perhaps a WARN_ON() or similar would be appropriate.
next prev parent reply other threads:[~2014-03-06 20:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-06 17:18 [PATCH net-next V3 0/2] net: Affinity hint helper function Amir Vadai
2014-03-06 17:18 ` [PATCH net-next V3 1/2] net: Utility function to get affinity_hint by policy Amir Vadai
2014-03-06 20:38 ` David Miller [this message]
2014-03-06 22:24 ` Amir Vadai
2014-03-06 22:34 ` David Miller
2014-03-07 21:05 ` [PATCH net-next V3 1/2] " David Miller
2014-03-06 17:18 ` [PATCH net-next V3 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=20140306.153835.2248996436618700806.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=amirv@mellanox.com \
--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).