public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Size of file /proc/mtrr
@ 2001-10-03  9:50 Lorinczy Zsigmond
  0 siblings, 0 replies; only message in thread
From: Lorinczy Zsigmond @ 2001-10-03  9:50 UTC (permalink / raw)
  To: linux-kernel

Hy Folks!

I found a little problem about file /proc/mtrr: it shorter than it is...

zsiga-pc:/usr/src/linux# ls -l /proc/mtrr
-rw-r--r--    1 root     root          132 Oct  3 10:03 /proc/mtrr
                                       ^^^ 

zsiga-pc:/usr/src/linux# cat /proc/mtrr | wc -c
    203
    ^^^
 
zsiga-pc:/usr/src/linux# cat /proc/mtrr
reg00: base=0x00000000 (   0MB), size= 128MB: write-back, count=1
reg01: base=0x08000000 ( 128MB), size=  32MB: write-back, count=1
reg02: base=0xf5000000 (3920MB), size=   4MB: write-combining, count=1
 
zsiga-pc:/usr/src/linux# mc -v /proc/mtrr
File: /proc/mtrr  132 bytes  100%
reg00: base=0x00000000 (   0MB), size= 128MB: write-back, count=1
reg01: base=0x08000000 ( 128MB), size=  32MB: write-back, count=1

I looked into arch/i386/kernel/mtrr.c, I found variable ascii_buf_bytes,
wich contains the real length (203 in this case), and is copied into
'proc_root_mtrr->size' (line 1863) when changes.

The problem is that the procfs do not follow the changing of this value
(caching problem ?), so stat(2) reports the old length (132).

Here is a quick workaround: set proc_root_mtrr->size to zero

--- mtrr.bak    Fri Sep 21 19:55:22 2001
+++ mtrr.c      Wed Oct  3 10:07:45 2001
@@ -1860,7 +1860,7 @@
     devfs_set_file_size (devfs_handle, ascii_buf_bytes);
 #  ifdef CONFIG_PROC_FS
     if (proc_root_mtrr)
-       proc_root_mtrr->size = ascii_buf_bytes;
+       proc_root_mtrr->size = 0;
 #  endif  /*  CONFIG_PROC_FS  */
 }   /*  End Function compute_ascii  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-10-03  8:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-03  9:50 Size of file /proc/mtrr Lorinczy Zsigmond

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox