aboutsummaryrefslogtreecommitdiffstats
path: root/patches/fuel-nailgun-agent/0004-AArch64-Read-hugepage-size-from-proc-meminfo.patch
blob: 384dafcaab019a3ffa4f07d209cc30eba7e70434 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: Copyright (c) 2017 Enea AB and others.
:
: All rights reserved. This program and the accompanying materials
: are made available under the terms of the Apache License, Version 2.0
: which accompanies this distribution, and is available at
: http://www.apache.org/licenses/LICENSE-2.0
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Date: Sun, 15 Jan 2017 08:14:12 +0100
Subject: [PATCH] AArch64: Read hugepage size from /proc/meminfo

This method should be arch-indepedent, provided /proc/meminfo
reports the correct information.

Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
---
 agent | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/agent b/agent
index eeb4d26..d514de6 100755
--- a/agent
+++ b/agent
@@ -1399,6 +1399,13 @@ class NodeAgent
   def supported_hugepages
     return [2048, 1048576] if _get_detailed_cpuinfo['0'][:flags].include?('pdpe1gb')
     return [2048] if _get_detailed_cpuinfo['0'][:flags].include?('pse')
+    # AArch64 does not expose CPU flags, but we can rely on /proc/meminfo
+    File.open('/proc/meminfo').each do |l|
+      case l.strip
+        when /Hugepagesize:\s+(\d+)\s+kB/
+          return [$1.to_i()]
+        end
+    end
     []
   end