>> The right way to solve this is to make the Linux kernel contain the necessary >> heuristics to identify which tasks and thus cores need this to improve efficiency >> and then apply it automatically. >> >> Putting it in userspace is making a human do a machines job which isn't >> sustainable. >> >> By putting the heuristics in kernelspace Linux will improve performance also on >> workloads the human operator didn't think of as the machine will detect them from >> statictical or other behaviour patterns. > >In order to put the heuristics into kernelspace Linux, I think it >necessary to consider the following two points. > >1) Which cores are tied with the process? >This is different from the core on which the process can run. It >probably need to combine some CPU resource limit to avoid affecting >non-target processes. > >2) How to derive the value to set in the register? >It is necessary to verify whether an appropriate set value can be >derived using statistical information, etc. In addition, to prevent >the cost of automatic derivation from exceeding the value that would >be improved by it. > >I don't have a prospect for resolving these issues yet. I will >continue these considerations. Another approach would be to make the set of prefetch settings a task attribute. Then set them in the context switch code when the process is about to run on a CPU. But that assumes you can cheaply change the attributes. If doing so requires multiple MSR writes (on x86) it might be a non-starter. -Tony
Hi Tony, Thanks for the comment. > Another approach would be to make the set of prefetch settings a task attribute. > Then set them in the context switch code when the process is about to run on > a CPU. > > But that assumes you can cheaply change the attributes. If doing so requires > multiple MSR writes (on x86) it might be a non-starter. On the x86 and A64FX, each parameter for controlling hardware prefetch is contained in one register. The current specification makes each parameter a separate attribute, so we need to write as many times as there are parameters to change. However it is possible to change the attribute with one MSR write per core by changing multiple parameters before the context switch.
© 2016 - 2026 Red Hat, Inc.