On Fri 19-01-18 17:54:36, Christian König wrote: > Am 19.01.2018 um 13:20 schrieb Michal Hocko: > > On Fri 19-01-18 13:13:51, Michal Hocko wrote: > > > On Fri 19-01-18 12:37:51, Christian König wrote: > > > [...] > > > > The per file descriptor badness is/was just the much easier approach to > > > > solve the issue, because the drivers already knew which client is > > > > currently > > > > using which buffer objects. > > > > > > > > I of course agree that file descriptors can be shared between processes > > > > and > > > > are by themselves not killable. But at least for our graphics driven use > > > > case I don't see much of a problem killing all processes when a file > > > > descriptor is used by more than one at the same time. > > > Ohh, I absolutely see why you have chosen this way for your particular > > > usecase. I am just arguing that this would rather be more generic to be > > > merged. If there is absolutely no other way around we can consider it > > > but right now I do not see that all other options have been considered > > > properly. Especially when the fd based approach is basically wrong for > > > almost anybody else. > > And more importantly. Iterating over _all_ fd which is what is your > > approach is based on AFAIU is not acceptable for the OOM path. Even > > though oom_badness is not a hot path we do not really want it to take a > > lot of time either. Even the current iteration over all processes is > > quite time consuming. Now you want to add the number of opened files and > > that might be quite many per process. > > Mhm, crap that is a really good argument. > > How about adding a linked list of callbacks to check for the OOM killer to > check for each process? > > This way we can avoid finding the process where we need to account things on > when memory is allocated and still allow the OOM killer to only check the > specific callbacks it needs to determine the score of a process?
I might be oversimplifying but there really have to be a boundary when you have the target user context, no? Then do the accounting when you get data to the user. -- Michal Hocko SUSE Labs