From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932628AbbIUOY3 (ORCPT ); Mon, 21 Sep 2015 10:24:29 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:35676 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932121AbbIUOY1 (ORCPT ); Mon, 21 Sep 2015 10:24:27 -0400 Date: Mon, 21 Sep 2015 16:24:24 +0200 From: Michal Hocko To: Oleg Nesterov Cc: Linus Torvalds , Kyle Walker , Christoph Lameter , Andrew Morton , David Rientjes , Johannes Weiner , Vladimir Davydov , linux-mm , Linux Kernel Mailing List , Stanislav Kozina , Tetsuo Handa Subject: Re: can't oom-kill zap the victim's memory? Message-ID: <20150921142423.GC19811@dhcp22.suse.cz> References: <1442512783-14719-1-git-send-email-kwalker@redhat.com> <20150919150316.GB31952@redhat.com> <20150920125642.GA2104@redhat.com> <20150921134414.GA15974@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150921134414.GA15974@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 21-09-15 15:44:14, Oleg Nesterov wrote: [...] > So yes, in general oom_kill_process() can't call oom_unmap_func() directly. > That is why the patch uses queue_work(oom_unmap_func). The workqueue thread > takes mmap_sem and frees the memory allocated by user space. OK, this might have been a bit confusing. I didn't mean you cannot use mmap_sem directly from the workqueue context. You _can_ AFAICS. But I've mentioned that you _shouldn't_ use workqueue context in the first place because all the workers might be blocked on locks and new workers cannot be created due to memory pressure. This has been demostrated already where sysrq+f couldn't trigger OOM killer because the work item to do so was waiting for a worker which never came... So I think we probably need to do this in the OOM killer context (with try_lock) or hand over to a special kernel thread. I am not sure a special kernel thread is really worth that but maybe it will turn out to be a better choice. -- Michal Hocko SUSE Labs