Don't use more than 32 cpus for network queue affinities
IF we have more than 32 cpus, discard any cpus > 32 for network queue cpu affinities. Closes-Bug: 1461306 Change-Id: I6aff2af39f25a32c710d5cdf9708dad6b2a201c1
This commit is contained in:
parent
938f033a5d
commit
87f429928f
|
@ -4,7 +4,13 @@ Generate a HEX value used to set network device rsp_cpus value
|
|||
EOS
|
||||
) do |argv|
|
||||
number = argv[0].to_i
|
||||
fail "Argument should be the CPU number - integer value!" unless number.to_s == argv[0]
|
||||
fail "Argument should be the CPU number - positive integer value!" if number < 1
|
||||
# sysfs is unable to use more than 8 bit mask for cpu affinity
|
||||
# just use cpus 0-31 if > 32 cpus present
|
||||
# TODO: Remove these lines when sysfs supports > 8 bit mask for affinity
|
||||
if number > 32 then
|
||||
number = 32
|
||||
end
|
||||
((2 ** number) - 1).to_s(16)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,6 +18,15 @@ describe 'the cpu_affinity_hex function' do
|
|||
).to eq '3'
|
||||
end
|
||||
|
||||
it 'should calculate HEX affinity value for more 32 cpu' do
|
||||
expect(
|
||||
scope.function_cpu_affinity_hex(%w(32))
|
||||
).to eq 'ffffffff'
|
||||
expect(
|
||||
scope.function_cpu_affinity_hex(%w(33))
|
||||
).to eq 'ffffffff'
|
||||
end
|
||||
|
||||
it 'should raise an error if there is less than 1 arguments' do
|
||||
expect {
|
||||
scope.function_cpu_affinity_hexs([])
|
||||
|
@ -30,4 +39,10 @@ describe 'the cpu_affinity_hex function' do
|
|||
}.to raise_error
|
||||
end
|
||||
|
||||
it 'should raise an error if value is negative integer' do
|
||||
expect {
|
||||
scope.function_cpu_affinity_hex(%w(-1))
|
||||
}.to raise_error
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue