On 03/07/17 08:47 PM, Christian König wrote: > Am 03.07.2017 um 11:49 schrieb Michel Dänzer: >>> Instead of messing with all this I suggest that we just add a jiffies >>> based timeout to the BO when we can clear the flag. For kernel BOs this >>> timeout is just infinity. >>> >>> Then we check in amdgpu_cs_bo_validate() before generating the >>> placements if we could clear the flag and do so based on the timeout. >> The idea for this patch was to save the memory and CPU cycles needed for >> that approach. > But when we clear the flag on the end of the move we already moved the > BO to visible VRAM again. Right. Clearing the flag before the move would make the flag ineffective. We want to put the BO in CPU visible VRAM when the flag is set, because it means the BO has been accessed by the CPU since it was created or since it was last moved to VRAM. > Only on after the next swapout/swapin cycle we see an effect of that > change. Right, clearing the flag cannot have any effect before the next time the BO is moved to VRAM anyway. > Is that the intended approach? So yes, it is. The only significant difference to the timestamp based approach (for which John already posted patches before) is that this patch will remember any CPU access until the next time the BO is moved to VRAM, no matter how much time passes in between. BTW, one issue with the timestamp based approach is that we only get a page fault on the first CPU access after the BO was moved. So the timestamp only says how much time has passed since the first CPU access, not since the last CPU access. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer