Re: Kernel code and processor's Cache



On Apr 9, 3:14 pm, feng <xu_feng...@xxxxxxxxx> wrote:

the kernel cache can be switched off when
not used.

Not easily. You can't switch the cache off without a full writeback.
Having to wait for the writeback before you could get the user-space
code running would be a disaster.

And, of course, if the cache is off, you can't use its data, since it
might be stale. So the kernel would always start on an empty cache.

Also, this would dramatically increase the cost of the most common
system calls. Consider how often the main reason you invoked the
kernel is to get some data from user-space (likely user-space put it
into in the cache) or to pass some data to user-space (likely through
the cache since user-space will use it as soon as the kernel returns
it). Using separate caches would make all these operations *much* more
expensive.

Think about a simple system call like 'gettimeofday'. The kernel would
put the result into the memory locations the user code specified,
putting it into the kernel cache in such a design. Now we're about to
switch to user space, with the data the user space program is about to
need in the kernel cache we're about to switch off, then what?

DS
.



Relevant Pages

  • Re: Context Switching and Flash Memory
    ... 2)the kernel will process that call and queue up a ... 3)the kernel will then context switch into the next scheduled ... You forgot about the I/O cache. ...
    (comp.os.linux.development.system)
  • Re: Kernel code and processors Cache
    ... You can't switch the cache off without a full writeback. ... Having to wait for the writeback before you could get the user-space ... So the kernel would always start on an empty cache. ...
    (comp.os.linux.development.system)
  • Re: Cached memory never gets released
    ... Stock linux 2.4.26 kernel. ... Due to flash bug 3M of memory gets lost due to font memory getting lost ... The output of "free" cache number steadily grows. ... longer to exhaust all of system memory with the cache. ...
    (Linux-Kernel)
  • Hung task - sync - 2.6.33-rc7 w/md6 multicore rebuild in process
    ... It seemed as though relcaim of fs cache became really slow once there were no more "free" pages. ... sync took a long time, and was reported by the kernel as a hung task - see below. ... # Device Drivers ...
    (Linux-Kernel)
  • Hung task - sync - 2.6.33-rc7 w/md6 multicore rebuild in process
    ... It seemed as though relcaim of fs cache became really slow once there were no more "free" pages. ... sync took a long time, and was reported by the kernel as a hung task - see below. ... # Device Drivers ...
    (Linux-Kernel)