* General question about caching
@ 2004-04-02 16:20 Christopher R. Johnson
2004-04-02 17:02 ` linas
0 siblings, 1 reply; 4+ messages in thread
From: Christopher R. Johnson @ 2004-04-02 16:20 UTC (permalink / raw)
To: linuxppc-dev
I have a tight footprint, and no swapping (in fact no disks). I notice
that /proc/meminfo reports:
total: used: free: shared: buffers: cached:
Mem: 31686656 30740480 946176 0 4591616 12210176
Swap: 0 0 0
MemTotal: 30944 kB
MemFree: 924 kB
MemShared: 0 kB
Buffers: 4484 kB
Cached: 11924 kB
SwapCached: 0 kB
Active: 22196 kB
Inactive: 5416 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 30944 kB
LowFree: 924 kB
SwapTotal: 0 kB
SwapFree: 0 kB
I only have rom and ram-based file systems, so I believe that disk
caching could and maybe should be reduced to use less space. Can I
control this? How? I notice that most of the cache_init routines
running in init/main.c use mempages as the arg. What would be the
ramifications of simply reporting less memory to those functions?
Downside? Danger?
Your input is appreciated!
cj
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: General question about caching
2004-04-02 16:20 General question about caching Christopher R. Johnson
@ 2004-04-02 17:02 ` linas
2004-04-02 19:27 ` Christopher R. Johnson
0 siblings, 1 reply; 4+ messages in thread
From: linas @ 2004-04-02 17:02 UTC (permalink / raw)
To: Christopher R. Johnson; +Cc: linuxppc-dev
On Fri, Apr 02, 2004 at 11:20:31AM -0500, Christopher R. Johnson wrote:
>
> I have a tight footprint, and no swapping (in fact no disks). I notice
> that /proc/meminfo reports:
...
> I only have rom and ram-based file systems, so I believe that disk
> caching could and maybe should be reduced to use less space. Can I
Why? What's wrong with the way it is? Is it impacting performance?
Thrashing? I can see a vague argument that its (nearly) pointless
to cache buffers from ramdisk ... but it would take some work to flesh
out this argument.
That said, you can play with parameters in /proc/sys/vm although
none of those directly affect the buffer cache size. Indirectly,
setting the flush times to zero might shrink the effective buffer
cache, though... maybe. And it might hurt performance, maybe ...
--linas
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: General question about caching
2004-04-02 17:02 ` linas
@ 2004-04-02 19:27 ` Christopher R. Johnson
2004-04-02 22:17 ` linas
0 siblings, 1 reply; 4+ messages in thread
From: Christopher R. Johnson @ 2004-04-02 19:27 UTC (permalink / raw)
To: linas; +Cc: linuxppc-dev
Ok, I'll give it a shot.
1. Isn't it taking up memory? If not then what does "Cached: 11924kB"
mean in meminfo? With my embedded application, I desperately need every
byte I can get; 11924k is HUGE in my little 32MB environment.
2. Not sure why its vague that avoiding needless caching in ram of stuff
that's already in ram is silly. Perhaps the performance hit is minimal,
but its still silly. At the very least won't there be some needless
data copying?
Which cache is used for file contents? That would be the one I don't need.
linas@austin.ibm.com wrote:
>On Fri, Apr 02, 2004 at 11:20:31AM -0500, Christopher R. Johnson wrote:
>
>>I have a tight footprint, and no swapping (in fact no disks). I notice
>>that /proc/meminfo reports:
>>
>...
>
>>I only have rom and ram-based file systems, so I believe that disk
>>caching could and maybe should be reduced to use less space. Can I
>>
>
>Why? What's wrong with the way it is? Is it impacting performance?
>Thrashing? I can see a vague argument that its (nearly) pointless
>to cache buffers from ramdisk ... but it would take some work to flesh
>out this argument.
>
>That said, you can play with parameters in /proc/sys/vm although
>none of those directly affect the buffer cache size. Indirectly,
>setting the flush times to zero might shrink the effective buffer
>cache, though... maybe. And it might hurt performance, maybe ...
>
>--linas
>
>
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: General question about caching
2004-04-02 19:27 ` Christopher R. Johnson
@ 2004-04-02 22:17 ` linas
0 siblings, 0 replies; 4+ messages in thread
From: linas @ 2004-04-02 22:17 UTC (permalink / raw)
To: Christopher R. Johnson; +Cc: linuxppc-dev
On Fri, Apr 02, 2004 at 02:27:12PM -0500, Christopher R. Johnson wrote:
>
> Ok, I'll give it a shot.
>
> 1. Isn't it taking up memory? If not then what does "Cached: 11924kB"
> mean in meminfo? With my embedded application, I desperately need every
> byte I can get; 11924k is HUGE in my little 32MB environment.
Its only using space that no one else is using. If you malloc more
space for yourself, the cache will shrink; but for the most part the
kernel will try to use all of the memory it can. No harm in that, it
usually helps.
> 2. Not sure why its vague that avoiding needless caching in ram of stuff
> that's already in ram is silly. Perhaps the performance hit is minimal,
> but its still silly. At the very least won't there be some needless
> data copying?
Yes, there's probably some needless copying, although I haven't really
read through the linux kernel ramdisk implementation, so I don't really
know. They might have gotten smart. But things like buffer heads
contain all sorts of flags and locks and linked lists and
what-not in there, so you can't just poof-and-make it go away.
> Which cache is used for file contents? That would be the one I don't need.
Not sure what you mean. The buffer cache?
Maybe you're thinking about the /proc/slabinfo? It hold the various
allocated and free blocks of various sizes, it speeds up allocation.
Different filesystems organize thier data in different ways; e.g. reiserfs
packs file tails into one block. There's no trivial way to figure out
what data is where in a file system, which is why the the "users" usually
go through buffers. You can layer block devices onto files in
arbitrary file systems on block devices ad infinitum; there's no trivial
untangling of this stuff.
--linas
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-04-02 22:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-02 16:20 General question about caching Christopher R. Johnson
2004-04-02 17:02 ` linas
2004-04-02 19:27 ` Christopher R. Johnson
2004-04-02 22:17 ` linas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).