Bug#596865: dphys-swapfile: Memory calculation is wrong for AMD 64bit systems

2010-09-14 Thread Simon Waters
Package: dphys-swapfile
Version: 20061020-1
Severity: normal


As noted in bug 564466 on AMD 64 systems the /proc/kcore size is reported as 
excessively large
due to the handling of vmalloc on that platform.

The kernel documentation was in error, claiming that kcore would be size of 
memory with a small adjustment 
when it is (now at least) more complex than that.

If we must rely on /proc interface then the second field of the first line of 
/proc/meminfo contains
size of RAM. As per changes below, however I'm not sure if relying on /proc is 
a good idea, I haven't checked kernel source to see if it is always the first 
line, or if the unit field is hard coded. So probably wise to make a more 
robust case than this.

I'm still trying to understand fully how AMD64 handles memory usage so probably 
wise to run this past someone who does understand the topic better.

52c52
   KCORESIZE=`ls -l /proc/kcore | awk '{ print $5 }'`
---
   # KCORESIZE=`ls -l /proc/kcore | awk '{ print $5 }'`
54c54,55
   MEMSIZE=`expr ${KCORESIZE} / 1048576 + 1`
---
   KCORESIZE=`head -1 /proc/meminfo | awk '{ print $2 }'`
   MEMSIZE=`expr ${KCORESIZE} / 1024 + 1`



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#596865: dphys-swapfile: Memory calculation is wrong for AMD 64bit systems

2010-09-14 Thread Axel Beckert
tag 596865 + moreinfo
kthxbye

Hi,

Simon Waters wrote:
 Package: dphys-swapfile
 Version: 20061020-1
 Severity: normal

 Subject: dphys-swapfile: Memory calculation is wrong for AMD 64bit systems

 As noted in bug 564466 [...]

While the subject of your bug report suggests that you are reporting
the same issue as #564466, the fact that you seem to know about that
bug makes me wonder what kind of problem you really try to report, as
the remainder of your report just seems to document some details of
the already fixed issue of #564466 (http://bugs.debian.org/564466):

 on AMD 64 systems the /proc/kcore size is reported as excessively
 large due to the handling of vmalloc on that platform.
 
 The kernel documentation was in error, claiming that kcore would be
 size of memory with a small adjustment when it is (now at least)
 more complex than that.
 
 If we must rely on /proc interface then the second field of the
 first line of /proc/meminfo contains size of RAM. As per changes
 below, however I'm not sure if relying on /proc is a good idea, I
 haven't checked kernel source to see if it is always the first line,
 or if the unit field is hard coded. So probably wise to make a more
 robust case than this.
 
 I'm still trying to understand fully how AMD64 handles memory usage
 so probably wise to run this past someone who does understand the
 topic better.

In 20061020-3 this is solved as follows:

  # this seems to be the nearest to physical RAM size, lacks about 60k
  #   but it actually then fails from AMD64 kernel 2.6.32 onwards
  #KCORESIZE=`ls -l /proc/kcore | awk '{ print $5 }'`
  ## make MBytes which rounded down will be exactly 1 too few, so add 1
  #MEMSIZE=`expr ${KCORESIZE} / 1048576 + 1`
  # so second attempt at finding out physical RAM size, lacks about 10M
  #   see how long this variant stays usable :-)
  MEMTOTAL=`grep '^MemTotal:' /proc/meminfo | awk '{ print $2 }'`
  # make MBytes which rounded down will be about 10 too few, so add 10
  MEMSIZE=`expr ${MEMTOTAL} / 1024 + 10`

Regards, Axel
-- 
 ,''`.  |  Axel Beckert a...@debian.org, http://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE
  `-|  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org