Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently heard that Linux simply flushes the TLB cache when the corresponding data in that physical address is swapped out, resulting in underutilization of the TLB. I don't know whether all OSes do the same.

If this is true then will increasing RAM and avoiding context switching keep cache in TLB?

share|improve this question

It seems that Linux kernel handle TLB and TLB cache with the same approach. At the architecture independent level there is no thing like flushing a part or entire TLB cache AFAIK. The vm will for example page out things, and there are some hooks to this action which will trigger hardware dependent code if necessary. Depending on the CPU, the kernel might then do several page flushes for each page out, or the CPU supports range of page flushing, or it supports neither and the kernel uses the most expensive flush which flushes the complete cache.

There are two interesting articles on this topic:

share|improve this answer

To swap data out is quite a bit more expensive than deleting a TLB line (which won't be of any use afterwards). And flushing the full TLB is probably also much cheaper.

The Linux honchos are absolute performance freaks. If they do as you claim, it's because the affected architecture doesn't allow anything better (or it just doesn' matter).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.