From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751682AbcFVG5W (ORCPT ); Wed, 22 Jun 2016 02:57:22 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:33493 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750896AbcFVG5V (ORCPT ); Wed, 22 Jun 2016 02:57:21 -0400 Date: Wed, 22 Jun 2016 08:50:16 +0200 From: Michal Hocko To: Tetsuo Handa Cc: linux-mm@kvack.org, rientjes@google.com, oleg@redhat.com, vdavydov@parallels.com, mgorman@techsingularity.net, hughd@google.com, riel@redhat.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: mm, oom_reaper: How to handle race with oom_killer_disable() ? Message-ID: <20160622065016.GD7520@dhcp22.suse.cz> References: <201606212003.FFB35429.QtMOJFFFOLSHVO@I-love.SAKURA.ne.jp> <20160621114643.GE30848@dhcp22.suse.cz> <20160621132736.GF30848@dhcp22.suse.cz> <201606220032.EGD09344.VOSQOMFJOLHtFF@I-love.SAKURA.ne.jp> <20160621174617.GA27527@dhcp22.suse.cz> <201606220647.GGD48936.LMtJVOOOFFQFHS@I-love.SAKURA.ne.jp> <20160622064015.GB7520@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160622064015.GB7520@dhcp22.suse.cz> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 22-06-16 08:40:15, Michal Hocko wrote: > On Wed 22-06-16 06:47:48, Tetsuo Handa wrote: > > Michal Hocko wrote: > > > On Wed 22-06-16 00:32:29, Tetsuo Handa wrote: > > > > Michal Hocko wrote: > > > [...] > > > > > Hmm, what about the following instead. It is rather a workaround than a > > > > > full flaged fix but it seems much more easier and shouldn't introduce > > > > > new issues. > > > > > > > > Yes, I think that will work. But I think below patch (marking signal_struct > > > > to ignore TIF_MEMDIE instead of clearing TIF_MEMDIE from task_struct) on top of > > > > current linux.git will implement no-lockup requirement. No race is possible unlike > > > > "[PATCH 10/10] mm, oom: hide mm which is shared with kthread or global init". > > > > > > Not really. Because without the exit_oom_victim from oom_reaper you have > > > no guarantee that the oom_killer_disable will ever return. I have > > > mentioned that in the changelog. There is simply no guarantee the oom > > > victim will ever reach exit_mm->exit_oom_victim. > > > > Why? Since any allocation after setting oom_killer_disabled = true will be > > forced to fail, nobody will be blocked on waiting for memory allocation. Thus, > > the TIF_MEMDIE tasks will eventually reach exit_mm->exit_oom_victim, won't it? > > What if it gets blocked waiting for an operation which cannot make any > forward progress because it cannot proceed with an allocation (e.g. > an open coded allocation retry loop - not that uncommon when sending > a bio)? I mean if we want to guarantee a forward progress then there has > to be something to clear the flag no matter in what state the oom victim > is or give up on oom_killer_disable. That being said I guess the patch to try_to_freeze_tasks after oom_killer_disable should be simple enough to go for now and stable trees and we can come up with something less hackish later. I do not like the fact that oom_killer_disable doesn't act as a full "barrier" anymore. What do you think? -- Michal Hocko SUSE Labs