From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755418AbbITNTk (ORCPT ); Sun, 20 Sep 2015 09:19:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52425 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755295AbbITNTj (ORCPT ); Sun, 20 Sep 2015 09:19:39 -0400 Date: Sun, 20 Sep 2015 15:16:39 +0200 From: Oleg Nesterov To: Michal Hocko Cc: Kyle Walker , Christoph Lameter , Linus Torvalds , akpm@linux-foundation.org, rientjes@google.com, hannes@cmpxchg.org, vdavydov@parallels.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Stanislav Kozina , Tetsuo Handa Subject: Re: can't oom-kill zap the victim's memory? Message-ID: <20150920131639.GC2104@redhat.com> References: <1442512783-14719-1-git-send-email-kwalker@redhat.com> <20150919150316.GB31952@redhat.com> <20150919155819.GB9094@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150919155819.GB9094@dhcp22.suse.cz> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/19, Michal Hocko wrote: > > On Sat 19-09-15 17:03:16, Oleg Nesterov wrote: > > > > Stupid idea. Can't we help the memory hog to free its memory? This is > > orthogonal to other improvements we can do. > > > > Please don't tell me the patch below is ugly, incomplete and suboptimal > > in many ways, I know ;) I am not sure it is even correct. Just to explain > > what I mean. > > Unmapping the memory for the oom victim has been already mentioned as a > way to improve the OOM killer behavior. Nobody has implemented that yet > though unfortunately. I have that on my TODO list since we have > discussed it with Mel at LSF. OK, good. So perhaps we should try to do this. > > > Perhaps oom_unmap_func() should only zap the anonymous vmas... and there > > are a lot of other details which should be discussed if this can make any > > sense. > > I have just returned from an internal conference so my head is > completely cabbaged. I will have a look on Monday. From a quick look > the idea is feasible. You cannot rely on the worker context because > workqueues might be completely stuck with at this stage. Yes this is true. See another email, probably oom-kill.c needs its own kthread. And again, we should actually try to avoid queue_work or queue_kthread_work in any case. But not in the initial implementation. And initial implementation could use workqueues, I think. I the likely case system_unbound_wq pool should have an idle thread. > You also cannot > do take mmap_sem directly because that might be held already so you need > a try_lock instead. Still can't understand this part. See other emails, perhaps I missed something. > Focusing on anonymous vmas first sounds like a good > idea to me because that would be simpler I guess. And safer. Oleg.