From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f197.google.com (mail-wr0-f197.google.com [209.85.128.197]) by kanga.kvack.org (Postfix) with ESMTP id EF5206B0033 for ; Mon, 2 Oct 2017 10:31:48 -0400 (EDT) Received: by mail-wr0-f197.google.com with SMTP id 54so5627984wrz.3 for ; Mon, 02 Oct 2017 07:31:48 -0700 (PDT) Received: from mx1.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id m193si7872271wmb.37.2017.10.02.07.31.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 02 Oct 2017 07:31:47 -0700 (PDT) Date: Mon, 2 Oct 2017 16:31:44 +0200 From: Michal Hocko Subject: Re: [RFC] [PATCH] mm,oom: Offload OOM notify callback to a kernel thread. Message-ID: <20171002143144.c2oggms6piwidz25@dhcp22.suse.cz> References: <20170929065654-mutt-send-email-mst@kernel.org> <201709291344.FID60965.VHtMQFFJFSLOOO@I-love.SAKURA.ne.jp> <201710011444.IBD05725.VJSFHOOMOFtLQF@I-love.SAKURA.ne.jp> <20171002065801-mutt-send-email-mst@kernel.org> <20171002090627.547gkmzvutrsamex@dhcp22.suse.cz> <201710022033.GFE82801.HLOVOFFJtSFQMO@I-love.SAKURA.ne.jp> <20171002115035.7sph6ul6hsszdwa4@dhcp22.suse.cz> <20171002170642-mutt-send-email-mst@kernel.org> <20171002141900.acmcbilwhqethfhq@dhcp22.suse.cz> <20171002172349-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171002172349-mutt-send-email-mst@kernel.org> Sender: owner-linux-mm@kvack.org List-ID: To: "Michael S. Tsirkin" Cc: Tetsuo Handa , jasowang@redhat.com, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, paulmck@linux.vnet.ibm.com, josh@joshtriplett.org, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, virtualization@lists.linux-foundation.org, intel-gfx@lists.freedesktop.org, linux-mm@kvack.org On Mon 02-10-17 17:29:47, Michael S. Tsirkin wrote: > On Mon, Oct 02, 2017 at 04:19:00PM +0200, Michal Hocko wrote: > > On Mon 02-10-17 17:11:55, Michael S. Tsirkin wrote: > > > On Mon, Oct 02, 2017 at 01:50:35PM +0200, Michal Hocko wrote: > > [...] > > > > and some > > > > other call path is allocating while holding the lock. But you seem to be > > > > right and > > > > leak_balloon > > > > tell_host > > > > virtqueue_add_outbuf > > > > virtqueue_add > > > > > > > > can do GFP_KERNEL allocation and this is clearly wrong. Nobody should > > > > try to allocate while we are in the OOM path. Michael, is there any way > > > > to drop this? > > > > > > Yes - in practice it won't ever allocate - that path is never taken > > > with add_outbuf - it is for add_sgs only. > > > > > > IMHO the issue is balloon inflation which needs to allocate > > > memory. It does it under a mutex, and oom handler tries to take the > > > same mutex. > > > > try_lock for the oom notifier path should heal the problem then, righ? > > At least for as a quick fix. > > IMHO it definitely fixes the deadlock. But it does not fix the bug > that balloon isn't sometimes deflated on oom even though the deflate on > oom flag is set. Yes, that would require a more sophisticated fix. And I would argue that would require to drop oom handler and move deflate logic to a shrinker to better scale with the memory pressure rather than act on the very last moment. -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org