On Sun, Jul 23, 2006 at 09:57:56AM +0200, Sebastian Bremicker wrote:

> swapspace still does not start here, saying
> 
> Starting dynamic swap manager: swapspaceError: Parse error in /proc/meminfo:
> '                                               HugePages_Total:     0
> '
> 
> Did I forget to enable something in the kernel (read the docs but did not
> find a hint what that could be)?

It looks like yet another sudden change in the format of /proc/meminfo:
all lines in the kernels I've seen end with a unit.  Actually, the unit
is always "kB" in the kernels I've seen, but swapspace was prepared for
this changing suddenly.

What it wasn't prepared for, and this is what seems to have happened, is
newly added lines not having the unit specifier at all.  The program
exercises extreme care while parsing because it's better to do nothing
than to get bad data.

I've just committed a patch to make the care a bit less extreme.  Could
you test this?  You can get the latest source version from

  svn co svn://thaiopensource.org/swapspace/trunk/ swapspace

...Or you can just apply the attached patch.


Jeroen

Index: src/memory.c
===================================================================
--- src/memory.c        (revision 149)
+++ src/memory.c        (working copy)
@@ -120,8 +120,14 @@
       &result->value,
       fact);
 
-  if (unlikely(x < 3))
+  if (unlikely(x == 2))
   {
+    // Since Linux 2.6.18-mm4 or so, /proc/meminfo may contain lines without a
+    // unit or "factor" attached.
+    fact[0] = '\0';
+  }
+  else if (unlikely(x < 2))
+  {
     result->value = 0;
 
     // In Linux 2.4, /proc/meminfo starts with a header line with leading

Reply via email to