[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#66009: 32 Mb, but "Sorry, not enough memory" (caused by new kernels sysinfo syscall)



Package: boot-floppies
Version: N/A;
Severity: normal

The problem is that sysinfo has changed with recent kernels:
      Anything before 2.3.16
      (incl 2.2 and earlier) has:

      struct sysinfo {
              long uptime;                    /* Seconds since boot */
              unsigned long loads[3];         /* 1, 5, and 15 minute load averages */
              unsigned long totalram;         /* Total usable main memory size */
              unsigned long freeram;          /* Available memory size */
              unsigned long sharedram;        /* Amount of shared memory */
              unsigned long bufferram;        /* Memory used by buffers */
              unsigned long totalswap;        /* Total swap space size */
              unsigned long freeswap;         /* swap space still available */
              unsigned short procs;           /* Number of current processes */
              char _f[22];                    /* Pads structure to 64 bytes */
      };

      and units of memory items were bytes.  A few fields were added/removed in
      2.3.16 and .17, then the big change happened in 2.3.23 and is with us
      today:

      struct sysinfo {
              long uptime;                    /* Seconds since boot */
              unsigned long loads[3];         /* 1, 5, and 15 minute load averages */
              unsigned long totalram;         /* Total usable main memory size */
              unsigned long freeram;          /* Available memory size */
              unsigned long sharedram;        /* Amount of shared memory */
              unsigned long bufferram;        /* Memory used by buffers */
              unsigned long totalswap;        /* Total swap space size */
              unsigned long freeswap;         /* swap space still available */
              unsigned short procs;           /* Number of current processes */
              unsigned long totalhigh;        /* Total high memory size */
              unsigned long freehigh;         /* Available high memory size */
              unsigned int mem_unit;          /* Memory unit size in bytes */
              char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
      };

      Now the units returned are essentially pages, and userspace needs to scale
      by mem_unit to get values in bytes.

Now, with 32 MB ram, busybox will add up totalram and totalswap and divide
by 1024 to get the Kb free, which makes it 7 Kb total ram for my system.
In fact I have mem_unit times that much (mem_unit being one page=4Kb).

Some Hardware will need recent kernels, so the busybox should know about the 
changes to sysinfo and act accordingly.

May the Source be with you.
			Goswin

-- System Information
Debian Release: 2.2
Architecture: i386
Kernel: Linux rut 2.2.14 #8 SMP Thu May 18 16:38:50 CEST 2000 i686




Reply to: