On Mon 25-11-13 17:29:20, David Rientjes wrote: > On Wed, 20 Nov 2013, Luigi Semenzato wrote: > > > Yes, I agree that we can't always prevent OOM situations, and in fact > > we tolerate OOM kills, although they have a worse impact on the users > > than controlled freeing does. > > > > If the controlled freeing is able to actually free memory in time before > hitting an oom condition, it should work pretty well. That ability is > seems to be highly dependent on sane thresholds for indvidual applications > and I'm afraid we can never positively ensure that we wakeup and are able > to free memory in time to avoid the oom condition. > > > Well OK here it goes. I hate to be a party-pooper, but the notion of > > a user-level OOM-handler scares me a bit for various reasons. > > > > 1. Our custom notifier sends low-memory warnings well ahead of memory > > depletion. If we don't have enough time to free memory then, what can > > the last-minute OOM handler do? > > > > The userspace oom handler doesn't necessarily guarantee that you can do > memory freeing, our usecase wants to do a priority-based oom killing that > is different from the kernel oom killer based on rss. To do that, you > only really need to read certain proc files and you can do killing based > on uptime, for example. You can also do a hierarchical traversal of > memcgs based on a priority. > > We already have hooks in the kernel oom killer, things like > /proc/sys/vm/oom_kill_allocating_task How would you implement oom_kill_allocating_task in userspace? You do not have any context on who is currently allocating or would you rely on reading /proc/*/stack to grep for allocation functions? > and /proc/sys/vm/panic_on_oom that [...] -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>