--- /dev/null
+From 0e264e7ac2b311aa9b42b183660a07b7e4e36b11 Mon Sep 17 00:00:00 2001
+From: Jim Gauld <james.gauld@windriver.com>
+Date: Fri, 9 Jun 2017 14:58:23 -0400
+Subject: [PATCH 1/1] CGTS-7164: Add resource options cpu-mask to affine drbd
+ kernel threads
+
+This adds "options { cpu-mask <cpumask>; }" section to DRBD resource
+configuration if 'cpumask' hexstring is defined. This governs kernel
+threads: drbd_w_<x>, drbd_r_<x>, drbd_a_<x>.
+
+Related notes:
+- if cpumask is not specified, the kernel threads drbd_w_<x>, drbd_r_<x>,
+ drbd_a_<x>, and drbd_as_<x> are affined to individual cores, each <x>
+ on a different core.
+
+- the remainder of the kernel threads are governed by kernel boot
+ argument kthread_cpus=<cpulist>. i.e., drbd-reissue, drbd<x>_submit,
+ jbd2/drbd<x>-8, drbd_as_<x>.
+
+- the drbd_a_<x> and drbd_as_<x> show up when DRBD is duplex.
+
+- the drbd_a_<x> threads have SCHED_RR scheduling policy.
+---
+ manifests/resource.pp | 3 +++
+ templates/header.res.erb | 6 ++++++
+ 2 files changed, 9 insertions(+)
+
+diff --git a/manifests/resource.pp b/manifests/resource.pp
+index d19ad8b..17e6142 100644
+--- a/manifests/resource.pp
++++ b/manifests/resource.pp
+@@ -26,6 +26,8 @@
+ # [link_speed] replication link network speed mbps
+ # [num_parallel] number of parallel drbd filesystems to sync
+ # [rtt_ms] round-trip-time milliseconds (i.e., ping between replication nodes)
++# [cpumask] cpu-affinity-mask for DRBD kernel threads (hexidecimal notation).
++# 0 means spread over all CPUs of the machine.
+ define drbd::resource (
+ $host1 = undef,
+ $host2 = undef,
+@@ -48,6 +50,7 @@ define drbd::resource (
+ $num_parallel = false,
+ $rtt_ms = false,
+ $resync_after = undef,
++ $cpumask = false,
+ $net_parameters = false,
+ $manage = true,
+ $ha_primary = false,
+diff --git a/templates/header.res.erb b/templates/header.res.erb
+index be53761..df52544 100644
+--- a/templates/header.res.erb
++++ b/templates/header.res.erb
+@@ -29,6 +29,12 @@ resource <%= @name %> {
+ <% end -%>
+ }
+
++<% if @cpumask -%>
++ options {
++ cpu-mask <%= @cpumask %>;
++ }
++<% end -%>
++
+ net {
+ after-sb-0pri discard-zero-changes;
+ after-sb-1pri discard-secondary;
+--
+1.8.3.1
+