[PATCH 2/2] nfs: Add RPCd task affinity config option
Daniel Cederman
cederman at gaisler.com
Thu Nov 13 09:09:03 UTC 2014
From: Daniel Hellstrom <daniel at gaisler.com>
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.
---
cpukit/libfs/src/nfsclient/src/librtemsNfs.h | 7 +++++++
cpukit/libfs/src/nfsclient/src/rpcio.c | 14 ++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/cpukit/libfs/src/nfsclient/src/librtemsNfs.h b/cpukit/libfs/src/nfsclient/src/librtemsNfs.h
index 491c3da..738aa8e 100644
--- a/cpukit/libfs/src/nfsclient/src/librtemsNfs.h
+++ b/cpukit/libfs/src/nfsclient/src/librtemsNfs.h
@@ -98,6 +98,13 @@ extern "C" {
*/
extern rtems_task_priority rpciodPriority;
+/** 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 cpu_set_t *rpciodCpuset;
+extern size_t rpciodCpusetSize;
+
/**
* @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 7324e02..e3d9d9a 100644
--- a/cpukit/libfs/src/nfsclient/src/rpcio.c
+++ b/cpukit/libfs/src/nfsclient/src/rpcio.c
@@ -84,6 +84,9 @@
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#ifdef RTEMS_SMP
+#include <sys/cpuset.h>
+#endif
#include "rpcio.h"
@@ -407,6 +410,8 @@ static rtems_interval ticksPerSec; /* cached system clock rate (WHO IS ASSUMED
*/
rtems_task_priority rpciodPriority = 0;
+cpu_set_t *rpciodCpuset = 0;
+size_t rpciodCpusetSize = 0;
#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)) );
--
2.1.3
More information about the devel
mailing list