[ENBD] 2.5.46 update

Peter T. Breuer enbd@lists.community.tummy.com
Thu, 14 Nov 2002 17:44:56 +0100 (MET)


"A month of sundays ago Tad Kollar wrote:"
> Looks like a memory leak? Maybe? Not sure how to debug this...
> 
>  >lsmod
> Module                  Size  Used by    Not tainted
> enbd                  1161282876

That is a memory leak. How much memory do you have? That's 1.16GB.

Well spotted!

Hmm .. I didn't think kmalloc was accounted to the module. In fact,
I'm pretty sure it isn't in 2.4. But there is no other explanation!
That is not stack space! It is not static use. 

Now, we know we are not losing request structs, because teher are only a
finite number of them. We can only be losing buffers. That implies the
end_request code is not releasing something it should release.


>  >cat /proc/meminfo
> MemTotal:      1033804 kB

That's 1GB.  Less than the memory leak!

> MemFree:        762848 kB

And you have 340MB free. So \relax.

Looks like an accounting anomaly.

>  >cat /proc/nbdinfo
> Device a:       Open
> [a] State:      verify, rw, enabled, plug, last error 0, lives 0, bp 0

This connection has never died. So we cannot be losing memory through
re-inits.


> [a] Queued:     +0R/0W curr (check 0R/0W) +128R/128W max
> [a] Buffersize: 262144  (sectors=512, blocks=64)
> [a] Blocksize:  4096    (log=12)
> [a] Size:       480238464KB

480GB.

> [a] Blocks:     120059616
> [a] Sockets:    2       (*)     (+)
> [a] Requested:  12.614K (6.32K) (6.28K) 8.794KR/3.820KW max 2
> [a] Despatched: 12.614K (6.32K) (6.28K) 8.794KR/3.820KW md5 1.83KW (1.41K eq, 
> 434 ne, 0 dn)
> [a] Errored:    0       (0)     (0)     0+0
> [a] Pending:    0       (0)     (0)     0R/0W+0R/0W

This connect behaved perfectly.

> [a] B/s now:    0       (0R+0W)
> [a] B/s ave:    160K    (112KR+48.0KW)
> [a] B/s max:    166M    (109MR+57.6MW)
> [a] Spectrum:   99%1

Uh, somebody should shout "merge_requests=30" at it! It would probably
speed it up noticably. Or maybe not. Depends on the net's behaviour with
large transmit sizes.

> [a] Kthreads:   0       (0 waiting/0 running/1 max)
> [a] Cthreads:   2       (+)     (+)
> [a] Cpids:      2       (407)   (408)
> Device b:       Open
> [b] State:      verify, rw, enabled, plug, md5sum, last error 0, lives 0, bp 0
> [b] Queued:     +0R/0W curr (check 0R/0W) +48R/128W max
> [b] Buffersize: 262144  (sectors=512, blocks=64)
> [b] Blocksize:  4096    (log=12)
> [b] Size:       480238464KB

Also 480GB.

> [b] Blocks:     120059616
> [b] Sockets:    2       (+)     (*)
> [b] Requested:  12.242K (6.15K) (6.08K) 8.582KR/3.659KW max 32
> [b] Despatched: 12.242K (6.15K) (6.08K) 8.583KR/3.658KW md5 2.61KW (2.03K eq, 
> 595 ne, 0 dn)

Also fine.

> [b] Errored:    0       (0)     (0)     0+0
> [b] Pending:    0       (0)     (0)     -1R/1W+0R/0W

Ooops. I have an accounting error. I think I know of that.


> [b] B/s now:    0       (0R+0W)
> [b] B/s ave:    156K    (108KR+44.0KW)
> [b] B/s max:    120M    (81.3MR+38.8MW)
> [b] Spectrum:   99%1

Again, maybe merge_requests?

> [b] Kthreads:   0       (0 waiting/0 running/1 max)
> [b] Cthreads:   2       (+)     (+)
> [b] Cpids:      2       (413)   (414)
> Device c:       Open
> [c] State:      verify, rw, enabled, plug, md5sum, last error 0, lives 0, bp 0
> [c] Queued:     +0R/0W curr (check 0R/0W) +48R/128W max
> [c] Buffersize: 262144  (sectors=512, blocks=64)
> [c] Blocksize:  4096    (log=12)
> [c] Size:       480238464KB
> [c] Blocks:     120059616
> [c] Sockets:    2       (+)     (*)
> [c] Requested:  12.124K (5.91K) (6.21K) 8.502KR/3.621KW max 1
> [c] Despatched: 12.124K (5.91K) (6.21K) 8.502KR/3.621KW md5 1.66KW (1.28K eq, 
> 386 ne, 0 dn)
> [c] Errored:    0       (0)     (0)     0+0
> [c] Pending:    0       (0)     (0)     0R/0W+0R/0W
> [c] B/s now:    0       (0R+0W)
> [c] B/s ave:    156K    (108KR+44.0KW)
> [c] B/s max:    221M    (146MR+74.6MW)
> [c] Spectrum:   100%1
> [c] Kthreads:   0       (0 waiting/0 running/1 max)
> [c] Cthreads:   2       (+)     (+)
> [c] Cpids:      2       (417)   (418)
> Device d:       Open
> [d] State:      verify, rw, enabled, plug, md5sum, last error 0, lives 0, bp 0
> [d] Queued:     +0R/0W curr (check 0R/0W) +49R/128W max
> [d] Buffersize: 262144  (sectors=512, blocks=64)
> [d] Blocksize:  4096    (log=12)
> [d] Size:       480238464KB
> [d] Blocks:     120059616
> [d] Sockets:    2       (+)     (*)
> [d] Requested:  12.749K (6.65K) (6.09K) 8.627KR/4.122KW max 1
> [d] Despatched: 12.749K (6.65K) (6.09K) 8.627KR/4.122KW md5 3.14KW (2.46K eq, 
> 694 ne, 0 dn)
> [d] Errored:    0       (0)     (0)     0+0
> [d] Pending:    0       (0)     (0)     0R/0W+0R/0W
> [d] B/s now:    0       (0R+0W)
> [d] B/s ave:    164K    (108KR+52.0KW)
> [d] B/s max:    381M    (186MR+195MW)
> [d] Spectrum:   100%1
> [d] Kthreads:   0       (0 waiting/0 running/1 max)
> [d] Cthreads:   2       (+)     (+)
> [d] Cpids:      2       (421)   (422)
> Device e:       Open
> [e] State:      verify, rw, enabled, plug, md5sum, last error 0, lives 0, bp 0
> [e] Queued:     +0R/0W curr (check 0R/0W) +48R/128W max
> [e] Buffersize: 262144  (sectors=512, blocks=64)
> [e] Blocksize:  4096    (log=12)
> [e] Size:       480238464KB
> [e] Blocks:     120059616
> [e] Sockets:    2       (+)     (*)
> [e] Requested:  10.522K (5.45K) (5.06K) 8.061KR/2.461KW max 1
> [e] Despatched: 10.522K (5.45K) (5.06K) 8.061KR/2.461KW md5 1.48KW (1.16K eq, 
> 324 ne, 0 dn)
> [e] Errored:    0       (0)     (0)     0+0
> [e] Pending:    0       (0)     (0)     0R/0W+0R/0W
> [e] B/s now:    0       (0R+0W)
> [e] B/s ave:    132K    (100KR+28.0KW)
> [e] B/s max:    151M    (110MR+41.7MW)
> [e] Spectrum:   100%1
> [e] Kthreads:   0       (0 waiting/0 running/1 max)
> [e] Cthreads:   2       (+)     (+)
> [e] Cpids:      2       (425)   (426)
> Device f:       Open
> [f] State:      verify, rw, enabled, plug, last error 0, lives 0, bp 0
> [f] Queued:     +0R/0W curr (check 0R/0W) +48R/53W max
> [f] Buffersize: 262144  (sectors=512, blocks=64)
> [f] Blocksize:  4096    (log=12)
> [f] Size:       480238464KB
> [f] Blocks:     120059616
> [f] Sockets:    2       (+)     (*)
> [f] Requested:  8.2097K (4.03K) (4.17K) 7.775KR/445W    max 1
> [f] Despatched: 8.2097K (4.03K) (4.17K) 7.775KR/445W    md5 0W (0 eq, 0 ne, 0 dn)
> [f] Errored:    0       (0)     (0)     0+0
> [f] Pending:    0       (0)     (0)     0R/0W+0R/0W
> [f] B/s now:    0       (0R+0W)
> [f] B/s ave:    104K    (100KR+4.00KW)


Well, that's all fairly impressive. Now, how on earth does the kernel
calculate the memory size for modules?

Peter