Add copyright header to patch files
[armband.git] / patches / fuel-nailgun-agent / 0004-AArch64-Read-hugepage-size-from-proc-meminfo.patch
1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2017 Enea AB and others.
3 :
4 : All rights reserved. This program and the accompanying materials
5 : are made available under the terms of the Apache License, Version 2.0
6 : which accompanies this distribution, and is available at
7 : http://www.apache.org/licenses/LICENSE-2.0
8 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
10 Date: Sun, 15 Jan 2017 08:14:12 +0100
11 Subject: [PATCH] AArch64: Read hugepage size from /proc/meminfo
12
13 This method should be arch-indepedent, provided /proc/meminfo
14 reports the correct information.
15
16 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
17 ---
18  agent | 7 +++++++
19  1 file changed, 7 insertions(+)
20
21 diff --git a/agent b/agent
22 index eeb4d26..d514de6 100755
23 --- a/agent
24 +++ b/agent
25 @@ -1399,6 +1399,13 @@ class NodeAgent
26    def supported_hugepages
27      return [2048, 1048576] if _get_detailed_cpuinfo['0'][:flags].include?('pdpe1gb')
28      return [2048] if _get_detailed_cpuinfo['0'][:flags].include?('pse')
29 +    # AArch64 does not expose CPU flags, but we can rely on /proc/meminfo
30 +    File.open('/proc/meminfo').each do |l|
31 +      case l.strip
32 +        when /Hugepagesize:\s+(\d+)\s+kB/
33 +          return [$1.to_i()]
34 +        end
35 +    end
36      []
37    end
38