summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Cederman <cederman@gaisler.com>2014-11-13 15:10:46 +0100
committerDaniel Hellstrom <daniel@gaisler.com>2014-11-19 16:18:10 +0100
commit905cea77d0260e094981f8c0b5f07106d1f9c03b (patch)
tree3b9e7f2cd4ee6f3789761245e4b0b4d1ade7d890
parent2d2059142c02ca218cc99aabb71425b1eae540fd (diff)
nfs: Add RPCd task affinity config option
Similar to the task priority option, the new CPU affinity option is first controlled by the RPCI specific rpciodCpuset option. If that is not set, it uses the global network task config. If that is also not set, it falls back to not setting the affinity at all, using all CPUs.
-rw-r--r--cpukit/libfs/src/nfsclient/src/librtemsNfs.h9
-rw-r--r--cpukit/libfs/src/nfsclient/src/rpcio.c14
2 files changed, 23 insertions, 0 deletions
diff --git a/cpukit/libfs/src/nfsclient/src/librtemsNfs.h b/cpukit/libfs/src/nfsclient/src/librtemsNfs.h
index 491c3da5df..530eee2144 100644
--- a/cpukit/libfs/src/nfsclient/src/librtemsNfs.h
+++ b/cpukit/libfs/src/nfsclient/src/librtemsNfs.h
@@ -98,6 +98,15 @@ extern "C" {
*/
extern rtems_task_priority rpciodPriority;
+#ifdef RTEMS_SMP
+/** CPU affinity of daemon; may be setup prior to calling rpcUdpInit();
+ * otherwise the network task CPU affinity from the rtems_bsdnet_config
+ * is used...
+ */
+extern const cpu_set_t *rpciodCpuset;
+extern size_t rpciodCpusetSize;
+#endif
+
/**
* @brief Sets the XIDs of the RPC transaction hash table.
*
diff --git a/cpukit/libfs/src/nfsclient/src/rpcio.c b/cpukit/libfs/src/nfsclient/src/rpcio.c
index 7324e02fd9..07bd9a3a08 100644
--- a/cpukit/libfs/src/nfsclient/src/rpcio.c
+++ b/cpukit/libfs/src/nfsclient/src/rpcio.c
@@ -84,6 +84,7 @@
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <sys/cpuset.h>
#include "rpcio.h"
@@ -407,6 +408,10 @@ static rtems_interval ticksPerSec; /* cached system clock rate (WHO IS ASSUMED
*/
rtems_task_priority rpciodPriority = 0;
+#ifdef RTEMS_SMP
+const cpu_set_t *rpciodCpuset = 0;
+size_t rpciodCpusetSize = 0;
+#endif
#if (DEBUG) & DEBUG_MALLOC
/* malloc wrappers for debugging */
@@ -983,6 +988,15 @@ struct sockwakeup wkup;
&rpciod);
assert( status == RTEMS_SUCCESSFUL );
+#ifdef RTEMS_SMP
+ if ( rpciodCpuset == 0 ) {
+ rpciodCpuset = rtems_bsdnet_config.network_task_cpuset;
+ rpciodCpusetSize = rtems_bsdnet_config.network_task_cpuset_size;
+ }
+ if ( rpciodCpuset != 0 )
+ rtems_task_set_affinity( rpciod, rpciodCpusetSize, rpciodCpuset );
+#endif
+
wkup.sw_pfn = rxWakeupCB;
wkup.sw_arg = &rpciod;
assert( 0==setsockopt(ourSock, SOL_SOCKET, SO_RCVWAKEUP, &wkup, sizeof(wkup)) );