Quick question about hyper-threading
On a hyper-threaded CPU, it seems to me that there could be a lot of cache-thrashing if the two processes running are completely unrelated. On the other hand, if one process has two threads, then they would benefit (or hurt less) from the cache-sharing, because they share the same memory space. Does the HT-aware scheduler attempt to take this into account by scheduling two related threads to run simultaneously on the same CPU as often as possible (unless you're in a multi-processor system and another CPU would otherwise be idle)?
Quoted 8 lines · Timothy Miller
On a hyper-threaded CPU, it seems to me that there could be a lot of cache-thrashing if the two processes running are completely unrelated. On the other hand, if one process has two threads, then they would benefit (or hurt less) from the cache-sharing, because they share the same memory space. Does the HT-aware scheduler attempt to take this into account by scheduling two related threads to run simultaneously on the same CPU as often as possible (unless you're in a multi-processor system and another CPU would otherwise be idle)?
No, the current scheduler (HT or stock 2.5) does not do this.
Your theories are correct. It would be interesting to try this and see.
It is nontrivial to do the ->mm checks in the scheduler though - certainly they cannot be done easily (if at all) in constant-time (i.e., it won't be O(1)).
Robert Love