1 |
I'd like to take a minute to thank Duncan, as I usually learn |
2 |
something new with his very informative posts! Thank you for taking the |
3 |
time to write such detailed posts, I for one look forward to reading |
4 |
them. |
5 |
|
6 |
On Mon, Mar 13, 2006 at 04:25:05PM -0700, Duncan wrote: |
7 |
> Generally, the first step in tracing such bugs is to see if it still |
8 |
> occurs with the mainline/vanilla kernels. If not, it's a patch in |
9 |
> whatever portage kernel you are using, so a Gentoo bug should be filed. |
10 |
> If it occurs with mainline, try at least to narrow it down to the rc where |
11 |
> the problem started, and file a kernel.org bug. Preferably, narrow it |
12 |
> down further to the daily git snapshot that did it. There are |
13 |
> instructions for doing that and even going further, narrowing it down to |
14 |
> the file and even procedure or line changed between the two git snapshots, |
15 |
> if you have the time to do so, in the doc/BUG-HUNTING text-file in your |
16 |
> kernel sources dir. Narrowing it down beyond the file level takes a lot |
17 |
> of time and patience, but narrowing it down to the file isn't too bad, and |
18 |
> narrowing it down to the GIT snapshot isn't hard at all, since tarballs of |
19 |
> those are made available at kernel.org just as if it were a normal kernel. |
20 |
> |
21 |
That is great information, and I will pursue this if I do indeed have |
22 |
some memory anomaly. |
23 |
|
24 |
> You didn't mention this so I'm not sure if you know to make the |
25 |
> distinction or not -- what sort of memory usage was it? Application usage |
26 |
> (indicates a leak) or simply cache or buffer usage? Linux will normally |
27 |
> fill most of memory with cache and buffers, as that's more efficient than |
28 |
> having it remain unused. |
29 |
> |
30 |
I did think about documenting my method of determining memory usage, and I |
31 |
did mention one of them, conky. One if the stats conky displays is RAM |
32 |
usage. I also use the free command to view memory |
33 |
|
34 |
> |
35 |
> if you aren't already aware of the distinction, learn the |
36 |
> difference between the different types of "used" memory, cache and buffers |
37 |
> vs. application memory, in particular. (FWIW because it's hard to find a |
38 |
> definition for buffers, the difference between cache and buffers is that |
39 |
> buffers are basically dedicated cache -- usable by one application not the |
40 |
> entire system, while cache is systemwide. That's not absolutely accurate, |
41 |
> but it's a practical/working definition. The two are often considered |
42 |
> together and should be, as their effect on memory is similar and |
43 |
> cumulative.) |
44 |
> |
45 |
I have been under the assumption that the "-/+ buffers/cache" line in the free |
46 |
command shows the actual memory "used" by the kernel and applications, and the |
47 |
"free" memory available for cache/buffers. This is how I have always based my |
48 |
assessment of memory usage. |
49 |
|
50 |
Here is a sample from this morning with just mutt, irssi, gaim and aterm |
51 |
running with fluxbox as the wm: |
52 |
|
53 |
total used free buffers cached |
54 |
Mem: 1028780 996560 32220 234996 202852 |
55 |
-/+ buffers/cache: 558712 470068 |
56 |
Swap: 979956 224 979732 |
57 |
|
58 |
I have thought that me "Mem: used" should always be as high as possible, |
59 |
meaning I am using as much ram in the system for applications as well as |
60 |
cache and buffers. I assumed the" -/+ buffers/cache used" is how much |
61 |
memory is consumed by the kernel and running applications. The "-/+ used |
62 |
number" is the one that I have seen grow overnight unusually high. This |
63 |
is also the number that conky seems to report on. Prior to "the change", |
64 |
and after a reboot, running the normal applications listed above, I |
65 |
average about 120000 on the "-/+ buffers/cache used". Maybe I am |
66 |
interpreting this data incorrectly, and I in fact do not have a problem. |
67 |
|
68 |
As a side bar, I saw mention in this list before, I think by Duncan, a |
69 |
"recommended" book on the Linux kernel. Unfortunately, it seems I deleted |
70 |
that thread, so if someone knows a good book on the kernel and memory |
71 |
management, I would appreciate any recommendations. |
72 |
|
73 |
> Kernel 2.6 has a swappiness tweaking control ( /proc/sys/vm/swappiness ), |
74 |
> that determines the balance between keeping stuff cached and swapping out |
75 |
> more applications, once all memory is used. This is set by default to |
76 |
> 60. If you want more applications kept in memory at the expense of |
77 |
> caching, set it lower, 0 means always prefer keeping applications in |
78 |
> memory even if they aren't used, which was the 2.4 series default. |
79 |
> Conversely, higher than 60 will favor cache more than applications, so |
80 |
> apps will tend to be swapped out quicker while cache is maintained. I |
81 |
> have a four-disk RAID setup here, with swap at the same priority over all |
82 |
> of them, so my swap is pretty fast and I keep swappiness set to 100, |
83 |
> favoring cache over application memory some of which won't be used very |
84 |
> often anyway. (I'm running RAID-6 for much of my system, for 2X |
85 |
> redundancy. Thus, on a four-disk array, it's two-way striped, while swap |
86 |
> is four-way striped, so reading apps back in from swap will be faster than |
87 |
> having to read data back in off the RAID-6 if it has been flushed out of |
88 |
> cache, and swappiness=100 is more efficient. Normal non-RAID single disk |
89 |
> usage would mean swap and file rereading off of disk would be roughly the |
90 |
> same speed, so the best performance would be closer to that 60 default |
91 |
> swappiness.) |
92 |
> |
93 |
Again, I learned something new today (and it's not even 8am here!), and |
94 |
I always kind of wondered why Duncan had some much swap and how he utilized it. |
95 |
This makes sense, and I will try tweaking this setting, as normally I don't |
96 |
use any swap. |
97 |
-- |
98 |
gentoo-amd64@g.o mailing list |