<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:16:26 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-1416] SMP Node thread affinity</title>
                <link>https://jira.whamcloud.com/browse/LU-1416</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;Lustre by default starts threads by the count of processors in the system. In a SMP system there may be 512 procs which create 512 Lustre threads!  The patch attached for version 1.8.7.70 reduces the number of threads to the number specified in the ksocknal.conf file as well allows to bind those threads to specific processors:&lt;br/&gt;
options ksocklnd ncpus=12&lt;br/&gt;
options ksocklnd cpu_affinity_off=256&lt;/p&gt;

&lt;p&gt;This reduction in threads and placement of those threads is essential for any lustre performance in a SMP system! Please consider integration of this new feature / patch in the general lustre distribution so everyone can benefit from better lustre performance in a SMP system.&lt;/p&gt;

&lt;p&gt;Thanks&lt;br/&gt;
Eva Hocks, SDSC&lt;/p&gt;</description>
                <environment>SMP / vSMP</environment>
        <key id="14461">LU-1416</key>
            <summary>SMP Node thread affinity</summary>
                <type id="2" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11311&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="3" iconUrl="https://jira.whamcloud.com/images/icons/priorities/major.svg">Major</priority>
                        <status id="5" iconUrl="https://jira.whamcloud.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="6">Not a Bug</resolution>
                                        <assignee username="liang">Liang Zhen</assignee>
                                    <reporter username="hocks">Eva Hocks</reporter>
                        <labels>
                    </labels>
                <created>Wed, 16 May 2012 14:54:13 +0000</created>
                <updated>Fri, 7 Mar 2014 23:41:54 +0000</updated>
                            <resolved>Fri, 7 Mar 2014 23:41:53 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                            <comments>
                            <comment id="38943" author="adilger" created="Wed, 16 May 2012 15:02:18 +0000"  >&lt;p&gt;Liang is already working in SMP thread affinity.&lt;/p&gt;</comment>
                            <comment id="38963" author="liang" created="Thu, 17 May 2012 00:38:15 +0000"  >&lt;p&gt;I think it could be fine to have such a patch for 1.8.x because we are not going to backport SMP patch from 2.3 to 1.8.x.&lt;/p&gt;

&lt;p&gt;Eva, I&apos;d like to see this patch, could you please post it?&lt;/p&gt;

&lt;p&gt;Liang&lt;/p&gt;</comment>
                            <comment id="39004" author="hocks" created="Thu, 17 May 2012 13:19:03 +0000"  >
&lt;p&gt;Liang,&lt;/p&gt;

&lt;p&gt;I included it as an attachment to the ticket. Please let me know if you cannot&lt;br/&gt;
get it.&lt;/p&gt;

&lt;p&gt;Thanks&lt;br/&gt;
Eva&lt;/p&gt;



</comment>
                            <comment id="39005" author="hocks" created="Thu, 17 May 2012 13:26:57 +0000"  >
&lt;p&gt;Here is the patch again as attachment as well as included in this email.&lt;/p&gt;

&lt;p&gt;-Eva&lt;/p&gt;


&lt;p&gt;diff -rwup lustre_b1_8.orig/aclocal.m4 lustre_b1_8/aclocal.m4&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/aclocal.m4	2012-04-05 14:54:39.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/aclocal.m4	2012-04-28 14:22:12.000000000 -0700&lt;br/&gt;
@@ -3597,7 +3597,7 @@ else&lt;br/&gt;
 	        #else&lt;br/&gt;
 	        unsigned long m;&lt;br/&gt;
 		#endif&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;set_cpus_allowed(&amp;amp;t, m);&lt;br/&gt;
+		set_cpus_allowed_ptr(&amp;amp;t, &amp;amp;m);&lt;br/&gt;
 	],[&lt;br/&gt;
 		AC_DEFINE(CPU_AFFINITY, 1, &lt;span class=&quot;error&quot;&gt;&amp;#91;kernel has cpu affinity support&amp;#93;&lt;/span&gt;)&lt;br/&gt;
 		AC_MSG_RESULT(&lt;span class=&quot;error&quot;&gt;&amp;#91;yes&amp;#93;&lt;/span&gt;)&lt;br/&gt;
diff -rwup lustre_b1_8.orig/configure lustre_b1_8/configure
	&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
		&lt;li&gt;
		&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
			&lt;li&gt;lustre_b1_8.orig/configure	2012-04-05 14:54:34.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/configure	2012-04-28 14:22:12.000000000 -0700&lt;br/&gt;
@@ -6189,7 +6189,7 @@ main (void)&lt;br/&gt;
 	        #else&lt;br/&gt;
 	        unsigned long m;&lt;br/&gt;
 		#endif&lt;/li&gt;
		&lt;/ul&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;set_cpus_allowed(&amp;amp;t, m);&lt;br/&gt;
+		set_cpus_allowed_ptr(&amp;amp;t, &amp;amp;m);&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;   ;&lt;br/&gt;
   return 0;&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lnet/autoconf/lustre-lnet.m4 lustre_b1_8/lnet/autoconf/lustre-lnet.m4&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lnet/autoconf/lustre-lnet.m4	2012-04-05 14:54:34.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lnet/autoconf/lustre-lnet.m4	2012-04-28 14:22:12.000000000 -0700&lt;br/&gt;
@@ -107,7 +107,7 @@ else&lt;br/&gt;
 	        #else&lt;br/&gt;
 	        unsigned long m;&lt;br/&gt;
 		#endif&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;set_cpus_allowed(&amp;amp;t, m);&lt;br/&gt;
+		set_cpus_allowed_ptr(&amp;amp;t, &amp;amp;m);&lt;br/&gt;
 	],[&lt;br/&gt;
 		AC_DEFINE(CPU_AFFINITY, 1, &lt;span class=&quot;error&quot;&gt;&amp;#91;kernel has cpu affinity support&amp;#93;&lt;/span&gt;)&lt;br/&gt;
 		AC_MSG_RESULT(&lt;span class=&quot;error&quot;&gt;&amp;#91;yes&amp;#93;&lt;/span&gt;)&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lnet/klnds/socklnd/socklnd.c lustre_b1_8/lnet/klnds/socklnd/socklnd.c
	&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
		&lt;li&gt;
		&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
			&lt;li&gt;lustre_b1_8.orig/lnet/klnds/socklnd/socklnd.c	2012-04-05 14:54:35.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lnet/klnds/socklnd/socklnd.c	2012-04-28 16:33:45.000000000 -0700&lt;br/&gt;
@@ -2371,7 +2371,14 @@ ksocknal_base_startup (void)&lt;br/&gt;
         ksocknal_data.ksnd_init = SOCKNAL_INIT_DATA;&lt;br/&gt;
         PORTAL_MODULE_USE;&lt;/li&gt;
		&lt;/ul&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;+#ifdef CPU_AFFINITY&lt;br/&gt;
+        if ((*ksocknal_tunables.ksnd_ncpus &amp;lt; 1) || (*ksocknal_tunables.ksnd_ncpus &amp;gt; ksocknal_nsched()))&lt;br/&gt;
+                *ksocknal_tunables.ksnd_ncpus = ksocknal_nsched();&lt;br/&gt;
+&lt;br/&gt;
+        ksocknal_data.ksnd_nschedulers = *ksocknal_tunables.ksnd_ncpus;&lt;br/&gt;
+#else&lt;br/&gt;
         ksocknal_data.ksnd_nschedulers = ksocknal_nsched();&lt;br/&gt;
+#endif&lt;br/&gt;
         LIBCFS_ALLOC(ksocknal_data.ksnd_schedulers,&lt;br/&gt;
                      sizeof(ksock_sched_t) * ksocknal_data.ksnd_nschedulers);&lt;br/&gt;
         if (ksocknal_data.ksnd_schedulers == NULL)&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_cb.c lustre_b1_8/lnet/klnds/socklnd/socklnd_cb.c&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_cb.c	2012-04-05 14:54:35.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lnet/klnds/socklnd/socklnd_cb.c	2012-04-28 16:36:54.000000000 -0700&lt;br/&gt;
@@ -2184,6 +2184,9 @@ ksocknal_connd (void *arg)&lt;br/&gt;
         cfs_daemonize (name);&lt;br/&gt;
         cfs_block_allsigs ();&lt;/p&gt;

&lt;p&gt;+        if (ksocknal_lib_bind_thread_to_node_cpu(id))&lt;br/&gt;
+                CERROR (&quot;Can&apos;t set CPU affinity for %s to node of CPU %d\n&quot;, name, (int)id % *ksocknal_tunables.ksnd_ncpus);&lt;br/&gt;
+&lt;br/&gt;
         cfs_waitlink_init (&amp;amp;wait);&lt;/p&gt;

&lt;p&gt;         cfs_spin_lock_bh (connd_lock);&lt;br/&gt;
@@ -2576,6 +2579,9 @@ ksocknal_reaper (void *arg)&lt;br/&gt;
         cfs_daemonize (&quot;socknal_reaper&quot;);&lt;br/&gt;
         cfs_block_allsigs ();&lt;/p&gt;

&lt;p&gt;+        if (ksocknal_lib_bind_thread_to_node_cpu(0))&lt;br/&gt;
+                CERROR (&quot;Can&apos;t set CPU affinity for %s to node of CPU %d\n&quot;, &quot;socknal_reaper&quot;, 0);&lt;br/&gt;
+&lt;br/&gt;
         CFS_INIT_LIST_HEAD(&amp;amp;enomem_conns);&lt;br/&gt;
         cfs_waitlink_init (&amp;amp;wait);&lt;/p&gt;

&lt;p&gt;diff -rwup lustre_b1_8.orig/lnet/klnds/socklnd/socklnd.h lustre_b1_8/lnet/klnds/socklnd/socklnd.h&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lnet/klnds/socklnd/socklnd.h	2012-04-05 14:54:35.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lnet/klnds/socklnd/socklnd.h	2012-04-28 15:55:14.000000000 -0700&lt;br/&gt;
@@ -127,6 +127,8 @@ typedef struct&lt;br/&gt;
         int              &lt;b&gt;ksnd_zc_recv_min_nfrags; /&lt;/b&gt; minimum # of fragments to enable ZC receive */&lt;br/&gt;
 #ifdef CPU_AFFINITY&lt;br/&gt;
         int              &lt;b&gt;ksnd_irq_affinity;    /&lt;/b&gt; enable IRQ affinity? */&lt;br/&gt;
+        unsigned int     &lt;b&gt;ksnd_ncpus;           /&lt;/b&gt; # CPUs */&lt;br/&gt;
+        unsigned int     &lt;b&gt;ksnd_cpu_affinity_off;/&lt;/b&gt; affinity offset */&lt;br/&gt;
 #endif&lt;br/&gt;
 #ifdef SOCKNAL_BACKOFF&lt;br/&gt;
         int              &lt;b&gt;ksnd_backoff_init;    /&lt;/b&gt; initial TCP backoff */&lt;br/&gt;
@@ -607,3 +609,4 @@ extern void ksocknal_lib_csum_tx(ksock_t&lt;br/&gt;
 extern int ksocknal_lib_memory_pressure(ksock_conn_t *conn);&lt;br/&gt;
 extern __u64 ksocknal_lib_new_incarnation(void);&lt;br/&gt;
 extern int ksocknal_lib_bind_thread_to_cpu(int id);&lt;br/&gt;
+extern int ksocknal_lib_bind_thread_to_node_cpu(int id);&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_lib-linux.c lustre_b1_8/lnet/klnds/socklnd/socklnd_lib-linux.c&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_lib-linux.c	2012-04-05 14:54:35.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lnet/klnds/socklnd/socklnd_lib-linux.c	2012-04-28 15:29:01.000000000 -0700&lt;br/&gt;
@@ -57,6 +57,8 @@ enum {&lt;br/&gt;
         SOCKLND_TX_BUFFER_SIZE,&lt;br/&gt;
         SOCKLND_NAGLE,&lt;br/&gt;
         SOCKLND_IRQ_AFFINITY,&lt;br/&gt;
+        SOCKLND_NCPUS,&lt;br/&gt;
+        SOCKLND_CPU_AFFINITY_OFF,&lt;br/&gt;
         SOCKLND_ROUND_ROBIN,&lt;br/&gt;
         SOCKLND_KEEPALIVE,&lt;br/&gt;
         SOCKLND_KEEPALIVE_IDLE,&lt;br/&gt;
@@ -86,6 +88,8 @@ enum &lt;/p&gt;
{
 #define SOCKLND_TX_BUFFER_SIZE  CTL_UNNUMBERED
 #define SOCKLND_NAGLE           CTL_UNNUMBERED
 #define SOCKLND_IRQ_AFFINITY    CTL_UNNUMBERED
+#define SOCKLND_NCPUS           CTL_UNNUMBERED
+#define SOCKLND_CPU_AFFINITY_OFF          CTL_UNNUMBERED
 #define SOCKLND_ROUND_ROBIN     CTL_UNNUMBERED
 #define SOCKLND_KEEPALIVE       CTL_UNNUMBERED
 #define SOCKLND_KEEPALIVE_IDLE  CTL_UNNUMBERED
@@ -263,6 +267,24 @@ static cfs_sysctl_table_t ksocknal_ctl_t
                 .proc_handler = &amp;amp;proc_dointvec,
                 .strategy = &amp;amp;sysctl_intvec,
         },&lt;br/&gt;
+        {
+                .ctl_name = SOCKLND_NCPUS,
+                .procname = &quot;ncpus&quot;,
+                .data     = &amp;amp;ksocknal_tunables.ksnd_ncpus,
+                .maxlen   = sizeof(int),
+                .mode     = 0444,
+                .proc_handler = &amp;amp;proc_dointvec,
+                .strategy = &amp;amp;sysctl_intvec,
+        },&lt;br/&gt;
+        {
+                .ctl_name = SOCKLND_CPU_AFFINITY_OFF,
+                .procname = &quot;cpu_affinity_off&quot;,
+                .data     = &amp;amp;ksocknal_tunables.cpu_affinity_off,
+                .maxlen   = sizeof(int),
+                .mode     = 0444,
+                .proc_handler = &amp;amp;proc_dointvec,
+                .strategy = &amp;amp;sysctl_intvec,
+        },&lt;br/&gt;
 #endif&lt;br/&gt;
         {&lt;br/&gt;
                 .ctl_name = SOCKLND_ROUND_ROBIN,&lt;br/&gt;
@@ -1296,11 +1318,11 @@ int&lt;br/&gt;
 ksocknal_lib_bind_thread_to_cpu(int id)&lt;br/&gt;
 {&lt;br/&gt;
 #if defined(CONFIG_SMP) &amp;amp;&amp;amp; defined(CPU_AFFINITY)&lt;br/&gt;
-        id = ksocknal_sched2cpu(id);&lt;br/&gt;
+        id = ksocknal_sched2cpu(id) + *ksocknal_tunables.ksnd_cpu_affinity_off;&lt;br/&gt;
         if (cpu_online(id)) {
                 cpumask_t m = CPU_MASK_NONE;
                 cpu_set(id, m);
-                set_cpus_allowed(current, m);
+                set_cpus_allowed_ptr(current, &amp;amp;m);
                 return 0;
         }&lt;br/&gt;
&lt;br/&gt;
@@ -1310,3 +1332,22 @@ ksocknal_lib_bind_thread_to_cpu(int id)&lt;br/&gt;
         return 0;&lt;br/&gt;
 #endif&lt;br/&gt;
 }&lt;br/&gt;
+&lt;br/&gt;
+int&lt;br/&gt;
+ksocknal_lib_bind_thread_to_node_cpu(int id)&lt;br/&gt;
+{&lt;br/&gt;
+#if defined(CONFIG_SMP) &amp;amp;&amp;amp; defined(CPU_AFFINITY)&lt;br/&gt;
+        id = ksocknal_sched2cpu(id) + *ksocknal_tunables.ksnd_cpu_affinity_off;&lt;br/&gt;
+        if (cpu_online(id)) {
+                cpumask_t m = node_to_cpumask(cpu_to_node(id));
+                set_cpus_allowed_ptr(current, &amp;amp;m);
+                return 0;
+        }&lt;br/&gt;
+&lt;br/&gt;
+        return -1;&lt;br/&gt;
+&lt;br/&gt;
+#else&lt;br/&gt;
+        return 0;&lt;br/&gt;
+#endif&lt;br/&gt;
+}&lt;br/&gt;
+&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_modparams.c lustre_b1_8/lnet/klnds/socklnd/socklnd_modparams.c&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_modparams.c	2012-04-05 14:54:35.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lnet/klnds/socklnd/socklnd_modparams.c	2012-04-28 16:34:12.000000000 -0700&lt;br/&gt;
@@ -131,6 +131,14 @@ CFS_MODULE_PARM(inject_csum_error, &quot;i&quot;,&lt;br/&gt;
 static int enable_irq_affinity = 0;&lt;br/&gt;
 CFS_MODULE_PARM(enable_irq_affinity, &quot;i&quot;, int, 0644,&lt;br/&gt;
                 &quot;enable IRQ affinity&quot;);&lt;br/&gt;
+&lt;br/&gt;
+static unsigned int ncpus = 0;&lt;br/&gt;
+CFS_MODULE_PARM(ncpus, &quot;i&quot;, int, 0444,&lt;br/&gt;
+                &quot;maximum number of CPUs to use&quot;);&lt;br/&gt;
+&lt;br/&gt;
+static unsigned int cpu_affinity_off = 0;&lt;br/&gt;
+CFS_MODULE_PARM(cpu_affinity_off, &quot;i&quot;, int, 0444,&lt;br/&gt;
+                &quot;CPU affinity offset&quot;);&lt;br/&gt;
 #endif&lt;br/&gt;
&lt;br/&gt;
 static int nonblk_zcack = 1;&lt;br/&gt;
@@ -194,6 +202,8 @@ ksock_tunables_t ksocknal_tunables = {
         .ksnd_zc_recv_min_nfrags = &amp;amp;zc_recv_min_nfrags,
 #ifdef CPU_AFFINITY
         .ksnd_irq_affinity    = &amp;amp;enable_irq_affinity,
+        .ksnd_ncpus           = &amp;amp;ncpus,
+        .ksnd_cpu_affinity_off = &amp;amp;cpu_affinity_off,
 #endif
 #ifdef SOCKNAL_BACKOFF
         .ksnd_backoff_init    = &amp;amp;backoff_init,
diff -rwup lustre_b1_8.orig/lustre/ptlrpc/service.c lustre_b1_8/lustre/ptlrpc/service.c
--- lustre_b1_8.orig/lustre/ptlrpc/service.c	2012-04-05 14:54:36.000000000 -0700
+++ lustre_b1_8/lustre/ptlrpc/service.c	2012-04-28 14:22:12.000000000 -0700
@@ -1687,7 +1687,8 @@ static int ptlrpc_main(void *arg)
                                 break;
                         num_cpu++;
                 }&lt;br/&gt;
-                set_cpus_allowed(cfs_current(), node_to_cpumask(cpu_to_node(cpu)));&lt;br/&gt;
+                cpumask_t m = node_to_cpumask(cpu_to_node(cpu));&lt;br/&gt;
+                set_cpus_allowed_ptr(cfs_current(), &amp;amp;m);&lt;br/&gt;
         }&lt;br/&gt;
 #endif&lt;br/&gt;
&lt;br/&gt;
diff -rwup lustre_b1_8.orig/aclocal.m4 lustre_b1_8/aclocal.m4&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/aclocal.m4	2012-04-28 17:33:39.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/aclocal.m4	2012-04-28 17:24:13.000000000 -0700&lt;br/&gt;
@@ -1924,13 +1924,13 @@ AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE,&lt;br/&gt;
&lt;br/&gt;
 # The actual symbol exported varies among architectures, so we need&lt;br/&gt;
 # to check many symbols (but only in the current architecture.)  No&lt;br/&gt;
-# matter what symbol is exported, the kernel #defines node_to_cpumask&lt;br/&gt;
+# matter what symbol is exported, the kernel #defines node_to_cpumask_map&lt;br/&gt;
 # to the appropriate function and that&apos;s what we use.&lt;br/&gt;
 AC_DEFUN(&lt;span class=&quot;error&quot;&gt;&amp;#91;LC_EXPORT_NODE_TO_CPUMASK&amp;#93;&lt;/span&gt;,&lt;br/&gt;
-         [LB_CHECK_SYMBOL_EXPORT(&lt;span class=&quot;error&quot;&gt;&amp;#91;node_to_cpumask&amp;#93;&lt;/span&gt;,&lt;br/&gt;
+         [LB_CHECK_SYMBOL_EXPORT(&lt;span class=&quot;error&quot;&gt;&amp;#91;node_to_cpumask_map&amp;#93;&lt;/span&gt;,&lt;br/&gt;
                                  &lt;span class=&quot;error&quot;&gt;&amp;#91;arch/$LINUX_ARCH/mm/numa.c&amp;#93;&lt;/span&gt;,&lt;br/&gt;
                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,&lt;br/&gt;
-                                            [node_to_cpumask is exported by&lt;br/&gt;
+                                            [node_to_cpumask_map is exported by&lt;br/&gt;
                                              the kernel])]) # x86_64&lt;br/&gt;
           LB_CHECK_SYMBOL_EXPORT(&lt;span class=&quot;error&quot;&gt;&amp;#91;node_to_cpu_mask&amp;#93;&lt;/span&gt;,&lt;br/&gt;
                                  &lt;span class=&quot;error&quot;&gt;&amp;#91;arch/$LINUX_ARCH/kernel/smpboot.c&amp;#93;&lt;/span&gt;,&lt;br/&gt;
diff -rwup lustre_b1_8.orig/configure lustre_b1_8/configure&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/configure	2012-04-28 17:33:39.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/configure	2012-04-28 17:23:24.000000000 -0700&lt;br/&gt;
@@ -10276,14 +10276,14 @@ _ACEOF&lt;br/&gt;
 fi&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
-          echo &quot;$as_me:$LINENO: checking if Linux was built with symbol node_to_cpumask exported&quot; &amp;gt;&amp;amp;5&lt;br/&gt;
-echo $ECHO_N &quot;checking if Linux was built with symbol node_to_cpumask exported... $ECHO_C&quot; &amp;gt;&amp;amp;6&lt;br/&gt;
-grep -q -E &apos;[&lt;span class=&quot;error&quot;&gt;&amp;#91;:space:&amp;#93;&lt;/span&gt;]node_to_cpumask[&lt;span class=&quot;error&quot;&gt;&amp;#91;:space:&amp;#93;&lt;/span&gt;]&apos; $LINUX/$SYMVERFILE 2&amp;gt;/dev/null&lt;br/&gt;
+          echo &quot;$as_me:$LINENO: checking if Linux was built with symbol node_to_cpumask_map exported&quot; &amp;gt;&amp;amp;5&lt;br/&gt;
+echo $ECHO_N &quot;checking if Linux was built with symbol node_to_cpumask_map exported... $ECHO_C&quot; &amp;gt;&amp;amp;6&lt;br/&gt;
+grep -q -E &apos;[&lt;span class=&quot;error&quot;&gt;&amp;#91;:space:&amp;#93;&lt;/span&gt;]node_to_cpumask_map[&lt;span class=&quot;error&quot;&gt;&amp;#91;:space:&amp;#93;&lt;/span&gt;]&apos; $LINUX/$SYMVERFILE 2&amp;gt;/dev/null&lt;br/&gt;
 rc=$?&lt;br/&gt;
 if test $rc -ne 0; then&lt;br/&gt;
     export=0&lt;br/&gt;
     for file in arch/$LINUX_ARCH/mm/numa.c; do&lt;br/&gt;
-    	grep -q -E &quot;EXPORT_SYMBOL.*&amp;#40;node_to_cpumask&amp;#41;&quot; &quot;$LINUX/$file&quot; 2&amp;gt;/dev/null&lt;br/&gt;
+    	grep -q -E &quot;EXPORT_SYMBOL.*&amp;#40;node_to_cpumask_map&amp;#41;&quot; &quot;$LINUX/$file&quot; 2&amp;gt;/dev/null&lt;br/&gt;
     	rc=$?&lt;br/&gt;
 	if test $rc -eq 0; then&lt;br/&gt;
 		export=1&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_lib-linux.c lustre_b1_8/lnet/klnds/socklnd/socklnd_lib-linux.c&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_lib-linux.c	2012-04-28 17:33:39.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lnet/klnds/socklnd/socklnd_lib-linux.c	2012-04-28 17:31:13.000000000 -0700&lt;br/&gt;
@@ -1339,8 +1339,8 @@ ksocknal_lib_bind_thread_to_node_cpu(int&lt;br/&gt;
 #if defined(CONFIG_SMP) &amp;amp;&amp;amp; defined(CPU_AFFINITY)&lt;br/&gt;
         id = ksocknal_sched2cpu(id) + *ksocknal_tunables.ksnd_cpu_affinity_off;&lt;br/&gt;
         if (cpu_online(id)) {
-                cpumask_t m = node_to_cpumask(cpu_to_node(id));
-                set_cpus_allowed_ptr(current, &amp;amp;m);
+                cpumask_t *m = node_to_cpumask_map[cpu_to_node(id)];
+                set_cpus_allowed_ptr(current, m);
                 return 0;
         }&lt;br/&gt;
&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lustre/autoconf/lustre-core.m4 lustre_b1_8/lustre/autoconf/lustre-core.m4&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lustre/autoconf/lustre-core.m4	2012-04-05 14:54:36.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lustre/autoconf/lustre-core.m4	2012-04-28 17:27:34.000000000 -0700&lt;br/&gt;
@@ -1013,13 +1013,13 @@ AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE,&lt;br/&gt;
&lt;br/&gt;
 # The actual symbol exported varies among architectures, so we need&lt;br/&gt;
 # to check many symbols (but only in the current architecture.)  No&lt;br/&gt;
-# matter what symbol is exported, the kernel #defines node_to_cpumask&lt;br/&gt;
+# matter what symbol is exported, the kernel #defines node_to_cpumask_map&lt;br/&gt;
 # to the appropriate function and that&apos;s what we use.&lt;br/&gt;
 AC_DEFUN(&lt;span class=&quot;error&quot;&gt;&amp;#91;LC_EXPORT_NODE_TO_CPUMASK&amp;#93;&lt;/span&gt;,&lt;br/&gt;
-         [LB_CHECK_SYMBOL_EXPORT(&lt;span class=&quot;error&quot;&gt;&amp;#91;node_to_cpumask&amp;#93;&lt;/span&gt;,&lt;br/&gt;
+         [LB_CHECK_SYMBOL_EXPORT(&lt;span class=&quot;error&quot;&gt;&amp;#91;node_to_cpumask_map&amp;#93;&lt;/span&gt;,&lt;br/&gt;
                                  &lt;span class=&quot;error&quot;&gt;&amp;#91;arch/$LINUX_ARCH/mm/numa.c&amp;#93;&lt;/span&gt;,&lt;br/&gt;
                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,&lt;br/&gt;
-                                            [node_to_cpumask is exported by&lt;br/&gt;
+                                            [node_to_cpumask_map is exported by&lt;br/&gt;
                                              the kernel])]) # x86_64&lt;br/&gt;
           LB_CHECK_SYMBOL_EXPORT(&lt;span class=&quot;error&quot;&gt;&amp;#91;node_to_cpu_mask&amp;#93;&lt;/span&gt;,&lt;br/&gt;
                                  &lt;span class=&quot;error&quot;&gt;&amp;#91;arch/$LINUX_ARCH/kernel/smpboot.c&amp;#93;&lt;/span&gt;,&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lustre/ptlrpc/service.c lustre_b1_8/lustre/ptlrpc/service.c&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lustre/ptlrpc/service.c	2012-04-28 17:33:39.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lustre/ptlrpc/service.c	2012-04-28 17:52:24.000000000 -0700&lt;br/&gt;
@@ -1679,6 +1679,7 @@ static int ptlrpc_main(void *arg)&lt;br/&gt;
          * we get the per-thread allocations on local node.  bug 7342 */&lt;br/&gt;
         if (svc-&amp;gt;srv_cpu_affinity) {&lt;br/&gt;
                 int cpu, num_cpu;&lt;br/&gt;
+                cpumask_t *m;&lt;br/&gt;
&lt;br/&gt;
                 for (cpu = 0, num_cpu = 0; cpu &amp;lt; num_possible_cpus(); cpu++) {
                         if (!cpu_online(cpu))
@@ -1687,8 +1688,8 @@ static int ptlrpc_main(void *arg)
                                 break;
                         num_cpu++;
                 }&lt;br/&gt;
-                cpumask_t m = node_to_cpumask(cpu_to_node(cpu));&lt;br/&gt;
-                set_cpus_allowed_ptr(cfs_current(), &amp;amp;m);&lt;br/&gt;
+                m = node_to_cpumask_map&lt;span class=&quot;error&quot;&gt;&amp;#91;cpu_to_node(cpu)&amp;#93;&lt;/span&gt;;&lt;br/&gt;
+                set_cpus_allowed_ptr(cfs_current(), m);&lt;br/&gt;
         }&lt;br/&gt;
 #endif&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
diff -rwup lustre_b1_8.orig/aclocal.m4 lustre_b1_8/aclocal.m4&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/aclocal.m4	2012-04-05 14:54:39.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/aclocal.m4	2012-04-28 14:22:12.000000000 -0700&lt;br/&gt;
@@ -3597,7 +3597,7 @@ else&lt;br/&gt;
 	        #else&lt;br/&gt;
 	        unsigned long m;&lt;br/&gt;
 		#endif&lt;br/&gt;
-		set_cpus_allowed(&amp;amp;t, m);&lt;br/&gt;
+		set_cpus_allowed_ptr(&amp;amp;t, &amp;amp;m);&lt;br/&gt;
 	],[&lt;br/&gt;
 		AC_DEFINE(CPU_AFFINITY, 1, &lt;span class=&quot;error&quot;&gt;&amp;#91;kernel has cpu affinity support&amp;#93;&lt;/span&gt;)&lt;br/&gt;
 		AC_MSG_RESULT(&lt;span class=&quot;error&quot;&gt;&amp;#91;yes&amp;#93;&lt;/span&gt;)&lt;br/&gt;
diff -rwup lustre_b1_8.orig/configure lustre_b1_8/configure&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/configure	2012-04-05 14:54:34.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/configure	2012-04-28 14:22:12.000000000 -0700&lt;br/&gt;
@@ -6189,7 +6189,7 @@ main (void)&lt;br/&gt;
 	        #else&lt;br/&gt;
 	        unsigned long m;&lt;br/&gt;
 		#endif&lt;br/&gt;
-		set_cpus_allowed(&amp;amp;t, m);&lt;br/&gt;
+		set_cpus_allowed_ptr(&amp;amp;t, &amp;amp;m);&lt;br/&gt;
 &lt;br/&gt;
   ;&lt;br/&gt;
   return 0;&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lnet/autoconf/lustre-lnet.m4 lustre_b1_8/lnet/autoconf/lustre-lnet.m4&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lnet/autoconf/lustre-lnet.m4	2012-04-05 14:54:34.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lnet/autoconf/lustre-lnet.m4	2012-04-28 14:22:12.000000000 -0700&lt;br/&gt;
@@ -107,7 +107,7 @@ else&lt;br/&gt;
 	        #else&lt;br/&gt;
 	        unsigned long m;&lt;br/&gt;
 		#endif&lt;br/&gt;
-		set_cpus_allowed(&amp;amp;t, m);&lt;br/&gt;
+		set_cpus_allowed_ptr(&amp;amp;t, &amp;amp;m);&lt;br/&gt;
 	],[&lt;br/&gt;
 		AC_DEFINE(CPU_AFFINITY, 1, &lt;span class=&quot;error&quot;&gt;&amp;#91;kernel has cpu affinity support&amp;#93;&lt;/span&gt;)&lt;br/&gt;
 		AC_MSG_RESULT(&lt;span class=&quot;error&quot;&gt;&amp;#91;yes&amp;#93;&lt;/span&gt;)&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lnet/klnds/socklnd/socklnd.c lustre_b1_8/lnet/klnds/socklnd/socklnd.c&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lnet/klnds/socklnd/socklnd.c	2012-04-05 14:54:35.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lnet/klnds/socklnd/socklnd.c	2012-04-28 16:33:45.000000000 -0700&lt;br/&gt;
@@ -2371,7 +2371,14 @@ ksocknal_base_startup (void)&lt;br/&gt;
         ksocknal_data.ksnd_init = SOCKNAL_INIT_DATA;&lt;br/&gt;
         PORTAL_MODULE_USE;&lt;br/&gt;
 &lt;br/&gt;
+#ifdef CPU_AFFINITY&lt;br/&gt;
+        if ((*ksocknal_tunables.ksnd_ncpus &amp;lt; 1) || (*ksocknal_tunables.ksnd_ncpus &amp;gt; ksocknal_nsched()))&lt;br/&gt;
+                *ksocknal_tunables.ksnd_ncpus = ksocknal_nsched();&lt;br/&gt;
+&lt;br/&gt;
+        ksocknal_data.ksnd_nschedulers = *ksocknal_tunables.ksnd_ncpus;&lt;br/&gt;
+#else&lt;br/&gt;
         ksocknal_data.ksnd_nschedulers = ksocknal_nsched();&lt;br/&gt;
+#endif&lt;br/&gt;
         LIBCFS_ALLOC(ksocknal_data.ksnd_schedulers,&lt;br/&gt;
                      sizeof(ksock_sched_t) * ksocknal_data.ksnd_nschedulers);&lt;br/&gt;
         if (ksocknal_data.ksnd_schedulers == NULL)&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_cb.c lustre_b1_8/lnet/klnds/socklnd/socklnd_cb.c&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_cb.c	2012-04-05 14:54:35.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lnet/klnds/socklnd/socklnd_cb.c	2012-04-28 16:36:54.000000000 -0700&lt;br/&gt;
@@ -2184,6 +2184,9 @@ ksocknal_connd (void *arg)&lt;br/&gt;
         cfs_daemonize (name);&lt;br/&gt;
         cfs_block_allsigs ();&lt;br/&gt;
 &lt;br/&gt;
+        if (ksocknal_lib_bind_thread_to_node_cpu(id))&lt;br/&gt;
+                CERROR (&quot;Can&apos;t set CPU affinity for %s to node of CPU %d\n&quot;, name, (int)id % *ksocknal_tunables.ksnd_ncpus);&lt;br/&gt;
+&lt;br/&gt;
         cfs_waitlink_init (&amp;amp;wait);&lt;br/&gt;
 &lt;br/&gt;
         cfs_spin_lock_bh (connd_lock);&lt;br/&gt;
@@ -2576,6 +2579,9 @@ ksocknal_reaper (void *arg)&lt;br/&gt;
         cfs_daemonize (&quot;socknal_reaper&quot;);&lt;br/&gt;
         cfs_block_allsigs ();&lt;br/&gt;
 &lt;br/&gt;
+        if (ksocknal_lib_bind_thread_to_node_cpu(0))&lt;br/&gt;
+                CERROR (&quot;Can&apos;t set CPU affinity for %s to node of CPU %d\n&quot;, &quot;socknal_reaper&quot;, 0);&lt;br/&gt;
+&lt;br/&gt;
         CFS_INIT_LIST_HEAD(&amp;amp;enomem_conns);&lt;br/&gt;
         cfs_waitlink_init (&amp;amp;wait);&lt;br/&gt;
 &lt;br/&gt;
diff -rwup lustre_b1_8.orig/lnet/klnds/socklnd/socklnd.h lustre_b1_8/lnet/klnds/socklnd/socklnd.h&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lnet/klnds/socklnd/socklnd.h	2012-04-05 14:54:35.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lnet/klnds/socklnd/socklnd.h	2012-04-28 15:55:14.000000000 -0700&lt;br/&gt;
@@ -127,6 +127,8 @@ typedef struct&lt;br/&gt;
         int              &lt;b&gt;ksnd_zc_recv_min_nfrags; /&lt;/b&gt; minimum # of fragments to enable ZC receive */&lt;br/&gt;
 #ifdef CPU_AFFINITY&lt;br/&gt;
         int              &lt;b&gt;ksnd_irq_affinity;    /&lt;/b&gt; enable IRQ affinity? */&lt;br/&gt;
+        unsigned int     &lt;b&gt;ksnd_ncpus;           /&lt;/b&gt; # CPUs */&lt;br/&gt;
+        unsigned int     &lt;b&gt;ksnd_cpu_affinity_off;/&lt;/b&gt; affinity offset */&lt;br/&gt;
 #endif&lt;br/&gt;
 #ifdef SOCKNAL_BACKOFF&lt;br/&gt;
         int              &lt;b&gt;ksnd_backoff_init;    /&lt;/b&gt; initial TCP backoff */&lt;br/&gt;
@@ -607,3 +609,4 @@ extern void ksocknal_lib_csum_tx(ksock_t&lt;br/&gt;
 extern int ksocknal_lib_memory_pressure(ksock_conn_t *conn);&lt;br/&gt;
 extern __u64 ksocknal_lib_new_incarnation(void);&lt;br/&gt;
 extern int ksocknal_lib_bind_thread_to_cpu(int id);&lt;br/&gt;
+extern int ksocknal_lib_bind_thread_to_node_cpu(int id);&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_lib-linux.c lustre_b1_8/lnet/klnds/socklnd/socklnd_lib-linux.c&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_lib-linux.c	2012-04-05 14:54:35.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lnet/klnds/socklnd/socklnd_lib-linux.c	2012-04-28 15:29:01.000000000 -0700&lt;br/&gt;
@@ -57,6 +57,8 @@ enum {&lt;br/&gt;
         SOCKLND_TX_BUFFER_SIZE,&lt;br/&gt;
         SOCKLND_NAGLE,&lt;br/&gt;
         SOCKLND_IRQ_AFFINITY,&lt;br/&gt;
+        SOCKLND_NCPUS,&lt;br/&gt;
+        SOCKLND_CPU_AFFINITY_OFF,&lt;br/&gt;
         SOCKLND_ROUND_ROBIN,&lt;br/&gt;
         SOCKLND_KEEPALIVE,&lt;br/&gt;
         SOCKLND_KEEPALIVE_IDLE,&lt;br/&gt;
@@ -86,6 +88,8 @@ enum { #define SOCKLND_TX_BUFFER_SIZE  CTL_UNNUMBERED #define SOCKLND_NAGLE           CTL_UNNUMBERED #define SOCKLND_IRQ_AFFINITY    CTL_UNNUMBERED+#define SOCKLND_NCPUS           CTL_UNNUMBERED+#define SOCKLND_CPU_AFFINITY_OFF          CTL_UNNUMBERED #define SOCKLND_ROUND_ROBIN     CTL_UNNUMBERED #define SOCKLND_KEEPALIVE       CTL_UNNUMBERED #define SOCKLND_KEEPALIVE_IDLE  CTL_UNNUMBERED@@ -263,6 +267,24 @@ static cfs_sysctl_table_t ksocknal_ctl_t                 .proc_handler = &amp;amp;proc_dointvec,                 .strategy = &amp;amp;sysctl_intvec,         }
&lt;p&gt;,&lt;br/&gt;
+        &lt;/p&gt;
{
+                .ctl_name = SOCKLND_NCPUS,
+                .procname = &quot;ncpus&quot;,
+                .data     = &amp;amp;ksocknal_tunables.ksnd_ncpus,
+                .maxlen   = sizeof(int),
+                .mode     = 0444,
+                .proc_handler = &amp;amp;proc_dointvec,
+                .strategy = &amp;amp;sysctl_intvec,
+        }
&lt;p&gt;,&lt;br/&gt;
+        &lt;/p&gt;
{
+                .ctl_name = SOCKLND_CPU_AFFINITY_OFF,
+                .procname = &quot;cpu_affinity_off&quot;,
+                .data     = &amp;amp;ksocknal_tunables.cpu_affinity_off,
+                .maxlen   = sizeof(int),
+                .mode     = 0444,
+                .proc_handler = &amp;amp;proc_dointvec,
+                .strategy = &amp;amp;sysctl_intvec,
+        }
&lt;p&gt;,&lt;br/&gt;
 #endif&lt;br/&gt;
         {&lt;br/&gt;
                 .ctl_name = SOCKLND_ROUND_ROBIN,&lt;br/&gt;
@@ -1296,11 +1318,11 @@ int&lt;br/&gt;
 ksocknal_lib_bind_thread_to_cpu(int id)&lt;br/&gt;
 {&lt;br/&gt;
 #if defined(CONFIG_SMP) &amp;amp;&amp;amp; defined(CPU_AFFINITY)&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;id = ksocknal_sched2cpu(id);&lt;br/&gt;
+        id = ksocknal_sched2cpu(id) + *ksocknal_tunables.ksnd_cpu_affinity_off;&lt;br/&gt;
         if (cpu_online(id)) 
{
                 cpumask_t m = CPU_MASK_NONE;
                 cpu_set(id, m);
-                set_cpus_allowed(current, m);
+                set_cpus_allowed_ptr(current, &amp;amp;m);
                 return 0;
         }&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;@@ -1310,3 +1332,22 @@ ksocknal_lib_bind_thread_to_cpu(int id)&lt;br/&gt;
         return 0;&lt;br/&gt;
 #endif&lt;br/&gt;
 }&lt;br/&gt;
+&lt;br/&gt;
+int&lt;br/&gt;
+ksocknal_lib_bind_thread_to_node_cpu(int id)&lt;br/&gt;
+{&lt;br/&gt;
+#if defined(CONFIG_SMP) &amp;amp;&amp;amp; defined(CPU_AFFINITY)&lt;br/&gt;
+        id = ksocknal_sched2cpu(id) + *ksocknal_tunables.ksnd_cpu_affinity_off;&lt;br/&gt;
+        if (cpu_online(id)) &lt;/p&gt;
{
+                cpumask_t m = node_to_cpumask(cpu_to_node(id));
+                set_cpus_allowed_ptr(current, &amp;amp;m);
+                return 0;
+        }
&lt;p&gt;+&lt;br/&gt;
+        return -1;&lt;br/&gt;
+&lt;br/&gt;
+#else&lt;br/&gt;
+        return 0;&lt;br/&gt;
+#endif&lt;br/&gt;
+}&lt;br/&gt;
+&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_modparams.c lustre_b1_8/lnet/klnds/socklnd/socklnd_modparams.c&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_modparams.c	2012-04-05 14:54:35.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lnet/klnds/socklnd/socklnd_modparams.c	2012-04-28 16:34:12.000000000 -0700&lt;br/&gt;
@@ -131,6 +131,14 @@ CFS_MODULE_PARM(inject_csum_error, &quot;i&quot;, &lt;br/&gt;
 static int enable_irq_affinity = 0;&lt;br/&gt;
 CFS_MODULE_PARM(enable_irq_affinity, &quot;i&quot;, int, 0644,&lt;br/&gt;
                 &quot;enable IRQ affinity&quot;);&lt;br/&gt;
+&lt;br/&gt;
+static unsigned int ncpus = 0;&lt;br/&gt;
+CFS_MODULE_PARM(ncpus, &quot;i&quot;, int, 0444,&lt;br/&gt;
+                &quot;maximum number of CPUs to use&quot;);&lt;br/&gt;
+&lt;br/&gt;
+static unsigned int cpu_affinity_off = 0;&lt;br/&gt;
+CFS_MODULE_PARM(cpu_affinity_off, &quot;i&quot;, int, 0444,&lt;br/&gt;
+                &quot;CPU affinity offset&quot;);&lt;br/&gt;
 #endif&lt;/p&gt;

&lt;p&gt; static int nonblk_zcack = 1;&lt;br/&gt;
@@ -194,6 +202,8 @@ ksock_tunables_t ksocknal_tunables = &lt;/p&gt;
{
         .ksnd_zc_recv_min_nfrags = &amp;amp;zc_recv_min_nfrags,
 #ifdef CPU_AFFINITY
         .ksnd_irq_affinity    = &amp;amp;enable_irq_affinity,
+        .ksnd_ncpus           = &amp;amp;ncpus,
+        .ksnd_cpu_affinity_off = &amp;amp;cpu_affinity_off,
 #endif
 #ifdef SOCKNAL_BACKOFF
         .ksnd_backoff_init    = &amp;amp;backoff_init,
diff -rwup lustre_b1_8.orig/lustre/ptlrpc/service.c lustre_b1_8/lustre/ptlrpc/service.c
--- lustre_b1_8.orig/lustre/ptlrpc/service.c	2012-04-05 14:54:36.000000000 -0700
+++ lustre_b1_8/lustre/ptlrpc/service.c	2012-04-28 14:22:12.000000000 -0700
@@ -1687,7 +1687,8 @@ static int ptlrpc_main(void *arg)
                                 break;
                         num_cpu++;
                 }
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;set_cpus_allowed(cfs_current(), node_to_cpumask(cpu_to_node(cpu)));&lt;br/&gt;
+                cpumask_t m = node_to_cpumask(cpu_to_node(cpu));&lt;br/&gt;
+                set_cpus_allowed_ptr(cfs_current(), &amp;amp;m);&lt;br/&gt;
         }&lt;br/&gt;
 #endif&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;diff -rwup lustre_b1_8.orig/aclocal.m4 lustre_b1_8/aclocal.m4&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/aclocal.m4	2012-04-28 17:33:39.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/aclocal.m4	2012-04-28 17:24:13.000000000 -0700&lt;br/&gt;
@@ -1924,13 +1924,13 @@ AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE,&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;The actual symbol exported varies among architectures, so we need&lt;/li&gt;
	&lt;li&gt;to check many symbols (but only in the current architecture.)  No
	&lt;ol&gt;
		&lt;li&gt;matter what symbol is exported, the kernel #defines node_to_cpumask&lt;br/&gt;
+# matter what symbol is exported, the kernel #defines node_to_cpumask_map&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
	&lt;li&gt;to the appropriate function and that&apos;s what we use.&lt;br/&gt;
 AC_DEFUN(&lt;span class=&quot;error&quot;&gt;&amp;#91;LC_EXPORT_NODE_TO_CPUMASK&amp;#93;&lt;/span&gt;,&lt;/li&gt;
&lt;/ol&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;[LB_CHECK_SYMBOL_EXPORT(&lt;span class=&quot;error&quot;&gt;&amp;#91;node_to_cpumask&amp;#93;&lt;/span&gt;,&lt;br/&gt;
+         [LB_CHECK_SYMBOL_EXPORT(&lt;span class=&quot;error&quot;&gt;&amp;#91;node_to_cpumask_map&amp;#93;&lt;/span&gt;,&lt;br/&gt;
                                  &lt;span class=&quot;error&quot;&gt;&amp;#91;arch/$LINUX_ARCH/mm/numa.c&amp;#93;&lt;/span&gt;,&lt;br/&gt;
                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,&lt;/li&gt;
	&lt;li&gt;[node_to_cpumask is exported by&lt;br/&gt;
+                                            [node_to_cpumask_map is exported by&lt;br/&gt;
                                              the kernel])]) # x86_64&lt;br/&gt;
           LB_CHECK_SYMBOL_EXPORT(&lt;span class=&quot;error&quot;&gt;&amp;#91;node_to_cpu_mask&amp;#93;&lt;/span&gt;,&lt;br/&gt;
                                  &lt;span class=&quot;error&quot;&gt;&amp;#91;arch/$LINUX_ARCH/kernel/smpboot.c&amp;#93;&lt;/span&gt;,&lt;br/&gt;
diff -rwup lustre_b1_8.orig/configure lustre_b1_8/configure
	&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
		&lt;li&gt;
		&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
			&lt;li&gt;lustre_b1_8.orig/configure	2012-04-28 17:33:39.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/configure	2012-04-28 17:23:24.000000000 -0700&lt;br/&gt;
@@ -10276,14 +10276,14 @@ _ACEOF&lt;br/&gt;
 fi&lt;/li&gt;
		&lt;/ul&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;



&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;echo &quot;$as_me:$LINENO: checking if Linux was built with symbol node_to_cpumask exported&quot; &amp;gt;&amp;amp;5&lt;br/&gt;
-echo $ECHO_N &quot;checking if Linux was built with symbol node_to_cpumask exported... $ECHO_C&quot; &amp;gt;&amp;amp;6&lt;br/&gt;
-grep -q -E &apos;[&lt;span class=&quot;error&quot;&gt;&amp;#91;:space:&amp;#93;&lt;/span&gt;]node_to_cpumask[&lt;span class=&quot;error&quot;&gt;&amp;#91;:space:&amp;#93;&lt;/span&gt;]&apos; $LINUX/$SYMVERFILE 2&amp;gt;/dev/null&lt;br/&gt;
+          echo &quot;$as_me:$LINENO: checking if Linux was built with symbol node_to_cpumask_map exported&quot; &amp;gt;&amp;amp;5&lt;br/&gt;
+echo $ECHO_N &quot;checking if Linux was built with symbol node_to_cpumask_map exported... $ECHO_C&quot; &amp;gt;&amp;amp;6&lt;br/&gt;
+grep -q -E &apos;[&lt;span class=&quot;error&quot;&gt;&amp;#91;:space:&amp;#93;&lt;/span&gt;]node_to_cpumask_map[&lt;span class=&quot;error&quot;&gt;&amp;#91;:space:&amp;#93;&lt;/span&gt;]&apos; $LINUX/$SYMVERFILE 2&amp;gt;/dev/null&lt;br/&gt;
 rc=$?&lt;br/&gt;
 if test $rc -ne 0; then&lt;br/&gt;
     export=0&lt;br/&gt;
     for file in arch/$LINUX_ARCH/mm/numa.c; do&lt;/li&gt;
	&lt;li&gt;grep -q -E &quot;EXPORT_SYMBOL.*&amp;#40;node_to_cpumask&amp;#41;&quot; &quot;$LINUX/$file&quot; 2&amp;gt;/dev/null&lt;br/&gt;
+    	grep -q -E &quot;EXPORT_SYMBOL.*&amp;#40;node_to_cpumask_map&amp;#41;&quot; &quot;$LINUX/$file&quot; 2&amp;gt;/dev/null&lt;br/&gt;
     	rc=$?&lt;br/&gt;
 	if test $rc -eq 0; then&lt;br/&gt;
 		export=1&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_lib-linux.c lustre_b1_8/lnet/klnds/socklnd/socklnd_lib-linux.c
	&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
		&lt;li&gt;
		&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
			&lt;li&gt;lustre_b1_8.orig/lnet/klnds/socklnd/socklnd_lib-linux.c	2012-04-28 17:33:39.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lnet/klnds/socklnd/socklnd_lib-linux.c	2012-04-28 17:31:13.000000000 -0700&lt;br/&gt;
@@ -1339,8 +1339,8 @@ ksocknal_lib_bind_thread_to_node_cpu(int&lt;br/&gt;
 #if defined(CONFIG_SMP) &amp;amp;&amp;amp; defined(CPU_AFFINITY)&lt;br/&gt;
         id = ksocknal_sched2cpu(id) + *ksocknal_tunables.ksnd_cpu_affinity_off;&lt;br/&gt;
         if (cpu_online(id)) 
{
-                cpumask_t m = node_to_cpumask(cpu_to_node(id));
-                set_cpus_allowed_ptr(current, &amp;amp;m);
+                cpumask_t *m = node_to_cpumask_map[cpu_to_node(id)];
+                set_cpus_allowed_ptr(current, m);
                 return 0;
         }&lt;/li&gt;
		&lt;/ul&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;diff -rwup lustre_b1_8.orig/lustre/autoconf/lustre-core.m4 lustre_b1_8/lustre/autoconf/lustre-core.m4&lt;br/&gt;
&amp;#8212; lustre_b1_8.orig/lustre/autoconf/lustre-core.m4	2012-04-05 14:54:36.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lustre/autoconf/lustre-core.m4	2012-04-28 17:27:34.000000000 -0700&lt;br/&gt;
@@ -1013,13 +1013,13 @@ AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE,&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;The actual symbol exported varies among architectures, so we need&lt;/li&gt;
	&lt;li&gt;to check many symbols (but only in the current architecture.)  No
	&lt;ol&gt;
		&lt;li&gt;matter what symbol is exported, the kernel #defines node_to_cpumask&lt;br/&gt;
+# matter what symbol is exported, the kernel #defines node_to_cpumask_map&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
	&lt;li&gt;to the appropriate function and that&apos;s what we use.&lt;br/&gt;
 AC_DEFUN(&lt;span class=&quot;error&quot;&gt;&amp;#91;LC_EXPORT_NODE_TO_CPUMASK&amp;#93;&lt;/span&gt;,&lt;/li&gt;
&lt;/ol&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;[LB_CHECK_SYMBOL_EXPORT(&lt;span class=&quot;error&quot;&gt;&amp;#91;node_to_cpumask&amp;#93;&lt;/span&gt;,&lt;br/&gt;
+         [LB_CHECK_SYMBOL_EXPORT(&lt;span class=&quot;error&quot;&gt;&amp;#91;node_to_cpumask_map&amp;#93;&lt;/span&gt;,&lt;br/&gt;
                                  &lt;span class=&quot;error&quot;&gt;&amp;#91;arch/$LINUX_ARCH/mm/numa.c&amp;#93;&lt;/span&gt;,&lt;br/&gt;
                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,&lt;/li&gt;
	&lt;li&gt;[node_to_cpumask is exported by&lt;br/&gt;
+                                            [node_to_cpumask_map is exported by&lt;br/&gt;
                                              the kernel])]) # x86_64&lt;br/&gt;
           LB_CHECK_SYMBOL_EXPORT(&lt;span class=&quot;error&quot;&gt;&amp;#91;node_to_cpu_mask&amp;#93;&lt;/span&gt;,&lt;br/&gt;
                                  &lt;span class=&quot;error&quot;&gt;&amp;#91;arch/$LINUX_ARCH/kernel/smpboot.c&amp;#93;&lt;/span&gt;,&lt;br/&gt;
diff -rwup lustre_b1_8.orig/lustre/ptlrpc/service.c lustre_b1_8/lustre/ptlrpc/service.c
	&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
		&lt;li&gt;
		&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
			&lt;li&gt;lustre_b1_8.orig/lustre/ptlrpc/service.c	2012-04-28 17:33:39.000000000 -0700&lt;br/&gt;
+++ lustre_b1_8/lustre/ptlrpc/service.c	2012-04-28 17:52:24.000000000 -0700&lt;br/&gt;
@@ -1679,6 +1679,7 @@ static int ptlrpc_main(void *arg)&lt;/li&gt;
		&lt;/ul&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
	&lt;li&gt;we get the per-thread allocations on local node.  bug 7342 */&lt;br/&gt;
         if (svc-&amp;gt;srv_cpu_affinity) {&lt;br/&gt;
                 int cpu, num_cpu;&lt;br/&gt;
+                cpumask_t *m;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;                 for (cpu = 0, num_cpu = 0; cpu &amp;lt; num_possible_cpus(); cpu++) &lt;/p&gt;
{
                         if (!cpu_online(cpu))
@@ -1687,8 +1688,8 @@ static int ptlrpc_main(void *arg)
                                 break;
                         num_cpu++;
                 }
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;cpumask_t m = node_to_cpumask(cpu_to_node(cpu));&lt;/li&gt;
	&lt;li&gt;set_cpus_allowed_ptr(cfs_current(), &amp;amp;m);&lt;br/&gt;
+                m = node_to_cpumask_map&lt;span class=&quot;error&quot;&gt;&amp;#91;cpu_to_node(cpu)&amp;#93;&lt;/span&gt;;&lt;br/&gt;
+                set_cpus_allowed_ptr(cfs_current(), m);&lt;br/&gt;
         }&lt;br/&gt;
 #endif&lt;/li&gt;
&lt;/ul&gt;

</comment>
                            <comment id="66136" author="mdiep" created="Mon, 9 Sep 2013 23:18:23 +0000"  >&lt;p&gt;fyi &lt;a href=&quot;http://review.whamcloud.com/#/c/7489/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/#/c/7489/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the patch that SDSC is using&lt;/p&gt;</comment>
                            <comment id="78778" author="jfc" created="Fri, 7 Mar 2014 23:41:54 +0000"  >&lt;p&gt;Patch for v 1.8 provided by customer.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="11392" name="lustre_b1_8.thread-affinity.diff" size="14799" author="hocks" created="Thu, 17 May 2012 13:27:00 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzv3bj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4037</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>